Supersized: playToggle

2019-09-09 11:51发布

问题:

I am using the Supersized background slideshow:

http://buildinternet.com/project/supersized/

with the following code to pause the Slideshow while loading a modal box.

Jquery

<script type="text/javascript">
$(function($) {
 $('#slideInfo').click(function() {
    api.playToggle();
  });
});

</script>

HTML

<div id="btnContainer">
<a id="slideInfo" href="#">More Info</a>
</div>

I am able to pause the slideshow. However, when I close the modal box the Slideshow won't play back again (it stays paused).

Is there a way to accomplish this?

Thanks!

EDIT:

Here's the test site:

http://clientes.ktulumedia.com/peppophotography.com

And the relevant code:

 <script type="text/javascript">
 $(function($) {
 $('#slideInfoplay').click(function() {
 api.playToggle();
 });
 });


 $(function($) {
 $('#sb-nav-close').click(function() {
 api.playToggle();
 });
 });

 </script>

Click where it says "test". I am able to open the modal box and pause the slideshow. However, when I close the modal box, I am unable to restart the slideshow.

回答1:

Your plugin usage is true but your jQuery document ready method is wrong.

$(function() {//you shouldnt use '$' inside function()
 $('#slideInfo').click(function() {
    api.playToggle();
  });
});

or

$(document).ready(function() {
 $('#slideInfo').click(function() {
    api.playToggle();
  });
});