Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. <nav id="sub" class="clearfix">
  2. <div id="lefty"><</div>
  3. <div class="container_element">
  4. <div class="inner_container">
  5. <a href="#"><div class="box">Estimate</div></a>
  6. <a href="#"><div class="box">About</div></a>
  7. <a href="#"><div class="box">Customer Information</div></a>
  8. <a href="#"><div class="box">Financing</div></a>
  9. <a href="#"><div class="box">Careers</div></a>
  10. <a href="#"><div class="box">Locate Us</div></a>
  11. <a href="#"><div class="box">Inspiration</div></a>
  12. </div>
  13. </div>
  14. <div id="righty">></div>
  15. </nav>
  16.  
  17. $(function(){
  18. var state = 0;
  19. var maxState = 7;
  20. var winWidth = $(window).width();
  21. $(window).resize(function(){
  22. winWidth = $(window).width();
  23. $('.container_element').width(winWidth-100);
  24. $('.container_element').scrollLeft((winWidth-100)*state);
  25. }).trigger('resize');
  26. $('#lefty').click(function(){
  27. if (state==0) {
  28. state = maxState;
  29. } else {
  30. state--;
  31. }
  32. $('.container_element').animate({scrollLeft:($(".box").width()*state)+'px'}, 800);
  33. });
  34. $('#righty').click(function(){
  35. if (state==maxState) {
  36. state = 0;
  37. } else {
  38. state++;
  39. }
  40. $('.container_element').animate({scrollLeft:($(".box").width()*state)+'px'}, 800);
  41. });
  42. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement