Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(".infinite").YMslider({ stop: function () {
- var $list = this.children(".panels"),
- $items = $list.children(),
- $first = $items.eq(0),
- $last = $items.eq(-1),
- width = this.width();
- // if we're currently viewing the last panel (get the 'margin-left' css
- // value (string) excluding "-" and "px", i.e. "600" == (3 - 1) * 300)
- $list.css("margin-left").slice(1, -2) == ($items.length - 1) * width ?
- // reset the 'margin-left' css value
- $list.css("margin-left", width) &&
- // get the last panel, apply some styles to it
- // and instert it right before the first one
- $first.before($last.css({ left: -width, position: "absolute" }))
- // if we're starting a new cycle, reset everything back to normal
- : $first.hasClass("last") && $last.after($first.css("position", "static"))
- } });
Add Comment
Please, Sign In to add comment