Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="https://code.jquery.com/jquery-3.1.0.min.js" ></script>
- <script>
- var slideshow;
- $('a.albums').hover(function(){
- var url = $(this).attr('href');
- var i = 0;
- if( $(this).find('img').attr('src').includes('thumb_nopic.png') )
- return;
- var thumbs = [];
- $.ajax({
- url: url,
- async:false,
- success: function(data) {
- $("img.image.thumbnail", data).each(function() {
- thumbs.push( $(this).attr("src").toString() );
- });
- }
- });
- var _link = this;
- $(this).find('img').css({'background-image': 'url('+$(this).find("img").attr("src")+')', 'background-size': 'cover','object-position': '-99999px 99999px', 'transition': 'background-image .25s'});
- slideshow = setInterval(function(){
- $(_link).find('img').css({'background-image': 'url('+thumbs[i]+')'});
- if( i < thumbs.length-1)
- i++;
- else i = 0;
- }, 1000);
- }, function(){
- clearInterval(slideshow);
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement