FOLLOW US

Blog

Pause autoPlay when the mouse enters the SlideDeck area (for WordPress)

By On December 16, 20106 Comments

This code snippet will pause the current deck’s autoPlay function when the mouse enters the deck area. You will need to be sure that you enter the ID of your SlideDeck in place of the current example ID: 461

Be sure to place this code into your theme after the wp_footer(); PHP function in your theme’s footer.php file. This code needs to be run after the regular WordPress SlideDeck JavaScript has been output, so it is imperative that it goes after the wp_footer(); function as this is where SlideDeck scripts are output.

<script type="text/javascript">
jQuery('.slidedeck_461').mouseenter(function(){
    jQuery(this).slidedeck().pauseAutoPlay = true;
});
</script>

The ID of your SlideDeck is shown in your list of SlideDecks after the name:

Leave a Reply

Comments (6) Responses

  1.  

    Bert

    Does this work on Slidedeck2? Does not seem to be working 🙁

  2.  

    Dani Meyer

    Bleh. How do you enter code in these comment strings? Would be a helpful thing to have in the instruction area. Regardless hopefully you can see where I was going with this.

  3.  

    Dani Meyer

    Woops sorry about that. Lets try this:


    jQuery(‘.slidedeck_2568’).mouseenter(function(){
    jQuery(this).slidedeck().pauseAutoPlay = true;
    });
    jQuery(‘.slidedeck_2568’).mouseleave(function(){
    jQuery(this).slidedeck().pauseAutoPlay = false;
    });

  4.  

    Dani Meyer

    I found I had to move mine above a / tb tag to get this to work.

    I also found that this snippet will stop the slides successfully but will not resume them once mouse leaves screen.

    This snippet will do both:

    [code]

    jQuery(‘.slidedeck_2568’).mouseenter(function(){
    jQuery(this).slidedeck().pauseAutoPlay = true;
    });
    jQuery(‘.slidedeck_2568’).mouseleave(function(){
    jQuery(this).slidedeck().pauseAutoPlay = false;
    });
    [/code]

  5.  

    Dani Meyer

    Using this with slidedeck 1 and wordpress with atahualpa theme. This stops auto rotation completely not just on mouseover.

    Help?

    Dani