Skip to content

Instantly share code, notes, and snippets.

@dkruchok
Created May 21, 2015 19:02
Show Gist options
  • Save dkruchok/813a41adfee0e93cf844 to your computer and use it in GitHub Desktop.
Save dkruchok/813a41adfee0e93cf844 to your computer and use it in GitHub Desktop.
My custom slider for current picture
var small = $(".from litle a img"),
big = $(".to big img");
small.each(function(i, el) {
var next = i + 1 == small.size() ? 0 : i + 1;
$(el)
.click(
function(event) {
event.preventDefault();
if (big.data("next") == next) return;
big.fadeTo(500, 0.1, function() {
big.attr({
"src": $(el)
.parent()
.attr("href")
})
.data({
"next": next
});
});
big.fadeTo(800, 1);
}
)
});
big.data({
"next": 1
})
.click(function(event) {
small.eq($(this)
.data("next"))
.click()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment