Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Have you tried unbinding the event before attaching a new one? like this:</p> <pre><code>switch($_GET["action"]){ case "brown": echo "&lt;script&gt;$(function(){ $(window).unbind("resize");//add this. you could also add //$('#supersized').html('') to remove markup created by the plugin $.supersized({ slides : [ {image : 'img/rooms-brown-01.jpg'}, {image : 'img/rooms-brown-02.jpg'} ] }) })&lt;/script&gt;"; break; </code></pre> <p>You might have to do this because the plugin binds an event to the window and even if you remove the previous html created by the plugin the old event is still binded and it fires twice.</p> <p>Tell me if you notice any difference</p> <p>EDIT - i have looked at the code of the plugin. The problem lies, i think, in the command on line 16:</p> <pre><code> setInterval("theslideshow()", options.slideinterval); </code></pre> <p>a function is called at a given interval, and if it's not cleared, when you call the plugin again, a new interval is set and so you have problems with the timing. You could correct the plugin like this. Instead of </p> <pre><code> if (options.slideshow == 1){ setInterval("theslideshow()", options.slideinterval); } </code></pre> <p>put </p> <pre><code> firstRunofThisPlugin = true; if (options.slideshow == 1){ if (firstRunofThisPlugin){ firstRunofThisPlugin = false; }else{ clearInterval(linkToTheLastInterval); } linkToTheLastInterval = setInterval("theslideshow()", options.slideinterval); } </code></pre> <p>What you are doing is save a reference of the setInterval() call and then clear that reference the next time you call the plugin.</p> <p>This uses two global variables which is bad, but if it solves the problem i can help you rewrite this without using globals.</p> <p>P.S. why don't you update the version of the plugin?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload