Created
March 9, 2015 22:56
-
-
Save josephbergdoll/25ea1c0b1cd95129c70b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Aritst Card Hover Thumb Interval | |
$('.artist-card.more-thumbs').each(function() { | |
var | |
thumb = '.image-thumb', | |
$thumb = $(this).find('.image-thumb'), | |
activeClass = 'thumb-active', | |
activeSelector = '.thumb-active'; | |
$(this).mouseenter(function() { | |
var $this = $(this); | |
if ($this.find(activeSelector).next(thumb).length) { | |
$this.find(activeSelector).removeClass(activeClass).next(thumb).addClass(activeClass); | |
} | |
else { | |
$this.find(activeSelector).removeClass(activeClass); | |
$thumb.first().addClass(activeClass); | |
} | |
cycleThumbs = setInterval( function() { | |
var | |
$activeThumb = $this.find('.thumb-active'), | |
$next = $activeThumb.next(thumb); | |
if ($next.length) { | |
$activeThumb.removeClass(activeClass); | |
$next.addClass(activeClass) | |
} | |
else { | |
$activeThumb.removeClass(activeClass); | |
$thumb.first().addClass(activeClass); | |
} | |
}, 1000); | |
}); | |
$(this).mouseleave(function() { | |
clearInterval(cycleThumbs); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment