JQuery Cycle fails on Page Refresh

Posted by Darknight on Stack Overflow See other posts from Stack Overflow or by Darknight
Published on 2010-04-30T16:10:48Z Indexed on 2010/04/30 16:17 UTC
Read the original article Hit count: 392

Filed under:

In a similar issue as this one:

http://stackoverflow.com/questions/1719475/jquery-cycle-firefox-squishing-images

I've managed to overcome the initial problem using Jeffs answer in the above link.

However now I have noticed a new bug, upon page refresh it simply does not work. I have tried a hard refresh (ctrl+F5) but this does not work.

However when you come page to the page it loads fine.

here is my modified version (taken from Jeff's):

<script type="text/javascript">
$(document).ready(function() 
{
var imagesRemaining = $('#slideshow img').length;
$('#slideshow img').bind('load', function(e) 
    {
        imagesRemaining = imagesRemaining - 1;
        if (imagesRemaining == 0) 
            {
                $('#slideshow').show();
                $('#slideshow').cycle({
                    fx: 'shuffle',
                    speed: 1200
                });
            }
    });
});
</script>

Any ideas? I've also tried JQuery Live but could not implement it correctly. I've also tried Meta tags to force images to load. But it only works first time round.

© Stack Overflow or respective owner

Related posts about jQuery