Guest User

Untitled

a guest
Oct 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. $(".infinite").YMslider({ stop: function () {
  2.  
  3. var $list = this.children(".panels"),
  4. $items = $list.children(),
  5. $first = $items.eq(0),
  6. $last = $items.eq(-1),
  7. width = this.width();
  8.  
  9. // if we're currently viewing the last panel (get the 'margin-left' css
  10. // value (string) excluding "-" and "px", i.e. "600" == (3 - 1) * 300)
  11. $list.css("margin-left").slice(1, -2) == ($items.length - 1) * width ?
  12.  
  13. // reset the 'margin-left' css value
  14. $list.css("margin-left", width) &&
  15. // get the last panel, apply some styles to it
  16. // and instert it right before the first one
  17. $first.before($last.css({ left: -width, position: "absolute" }))
  18.  
  19. // if we're starting a new cycle, reset everything back to normal
  20. : $first.hasClass("last") && $last.after($first.css("position", "static"))
  21.  
  22. } });​
Add Comment
Please, Sign In to add comment