Note that there are some explanatory texts on larger screens.

plurals
  1. POZeroclipboard multiple elements
    primarykey
    data
    text
    <p>I'm having trouble creating multiple Zeroclipboard instantiations in my code, with each instantiation launching a popup window after it is invoked.</p> <pre><code>&lt;a class="xxx" href="popup.url.php" &gt;&lt;span &gt;FRSDE3RD&lt;/a&gt; &lt;a class="xxx" href="popup.url2.php" &gt;&lt;span &gt;FRSDE3RD2&lt;/a&gt; &lt;a class="xxx" href="popup.url3.php" &gt;&lt;span &gt;FRSDE3RD3&lt;/a&gt; $(document).ready(function(){ ZeroClipboard.setMoviePath( 'path/to/swf/ZeroClipboard.swf' ); // setup single ZeroClipboard object for all our elements clip = new ZeroClipboard.Client(); clip.setHandCursor( true ); // assign a common mouseover function for all elements using jQuery $('a.xxx').mouseover( function() { // set the clip text to our innerHTML var url = $(this).attr("href"); var code = $(this).children('span').html(); clip.setText( $(this).children('span').html() );//this.innerHTML ); clip.glue(this); clip.addEventListener('onMouseDown', function(){ clip.reposition(this); clip.setText( code ); }); clip.addEventListener('onComplete', function(){ clip.reposition(this); popUp(url); }); }); }); function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=1024,height=768,left = 328,top = 141');"); } </code></pre> <p>I succeed on generating the copy to clipboard functionality, but if I use either onMouseUp, onComplete events to trigger popup function, it either fire like 4-5 popups or doesn't fire at all.</p> <p>P.S. I tried to adapt the solution from <a href="https://stackoverflow.com/questions/890444/how-to-load-an-ajax-response-into-clipboard-using-jquery-and-zeroclipboard">How to load an Ajax response into clipboard using jQuery and ZeroClipboard?</a> instead of ajax call just copy to clipboard and on complete to lunch a popup ... as I said didn't worked for me.</p> <p>What else I figured it out while having flashblocker enabled is that every time I rollover a CODE tag a new flash is being created on the same spot so this might be an explanation why I'm having 3-4 popup when I click it. If I rollover more, more popups come. Is there a way to stop the flash from creating on same spot or destroy on rollout?</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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