Search code examples
jqueryjquery-pluginsgoogle-chromesafaricycle

Jquery Cycle Plugin - webkit browsers start a paused cycle on refresh


This is my code

$('#gallery-photos').cycle({ 
            fx:     'fade', 
            speed:   500, 
            timeout: 3000, 
            pager:  '#gallery-navigation',
            requeueOnImageNotLoaded: true,
            after:  onAfter
        }).cycle('pause');

As you can see the cycle will stop after init, as Malsup itself showed in some posts around the internet... but when i refresh page with Chrome or Safari, the cycle starts, ignoring the pause command.

I have another slideshow in the same page that autostarts as default, but it is not involved with the previous one

$(document).ready(function() {
    $('#header-gallery-conteiner').cycle({ 
         fx:'scrollUp', 
         speed:  888,
         timeout: 4000,
         requeueOnImageNotLoaded: true
     });  
 });

How can i make it able to pause correctly even after refresh with webkit browsers?


Solution

  • move you first block of code inside the $(document).ready() event like this:

    $(document).ready(function() {
        $('#header-gallery-conteiner').cycle({ 
             fx:'scrollUp', 
             speed:  888,
             timeout: 4000,
             requeueOnImageNotLoaded: true
         });
         $('#gallery-photos').cycle({ 
             fx:     'fade', 
             speed:   500, 
             timeout: 3000, 
             pager:  '#gallery-navigation',
             requeueOnImageNotLoaded: true,
             after:  onAfter
         }).cycle('pause');
     });
    

    You should only have one function assigned to $(document).ready(), so if you have it also somewere else on your page get rid of it, and add the code to to the function above