Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Slider*/
- var totalImages = jQuery(".slider li").length;
- imageWidth = jQuery(".slider li:first").outerWidth(true)
- totalWidth = imageWidth * totalImages
- visibleImages = Math.round(jQuery(".slider").width() / imageWidth)
- visibleWidth = visibleImages * imageWidth
- stopPosition = (visibleWidth - totalWidth);
- var list = jQuery(".slider").width(totalWidth);
- jQuery(".next").click(function() {
- if (jQuery(".slider").position().left > stopPosition && !jQuery(".slider").is(":animated")) {
- jQuery(".slider").animate({ left: "-=" + 700 + "px" });
- }
- return false;
- });
- jQuery(".prev").click(function() {
- if (jQuery(".slider").position().left < 0 && !jQuery(".slider").is(":animated")) {
- jQuery(".slider").animate({ left: "+=" + 700 + "px" });
- }
- return false;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement