Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. /*Slider*/
  2. var totalImages = jQuery(".slider li").length;
  3. imageWidth = jQuery(".slider li:first").outerWidth(true)
  4. totalWidth = imageWidth * totalImages
  5. visibleImages = Math.round(jQuery(".slider").width() / imageWidth)
  6. visibleWidth = visibleImages * imageWidth
  7. stopPosition = (visibleWidth - totalWidth);
  8. var list = jQuery(".slider").width(totalWidth);
  9. jQuery(".next").click(function() {
  10. if (jQuery(".slider").position().left > stopPosition && !jQuery(".slider").is(":animated")) {
  11. jQuery(".slider").animate({ left: "-=" + 700 + "px" });
  12. }
  13. return false;
  14. });
  15. jQuery(".prev").click(function() {
  16. if (jQuery(".slider").position().left < 0 && !jQuery(".slider").is(":animated")) {
  17. jQuery(".slider").animate({ left: "+=" + 700 + "px" });
  18. }
  19. return false;
  20. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement