ZClip SWF does not align with the button position if the button position changes

I am currently using zclip / jquery code to allow copying to the clipboard. It is currently connected to a range button. It seems to use the SWF file above the button to allow flash-based copying to the clipboard. The problem is that when I dynamically add new elements to the page, the button position moves down, but the SWF position remains the same. Is there anything I can do to get zclip to follow the button? Zclip below:

$("#copyToClip").zclip({ path:'include/javascript/ZeroClipboard.swf', copy:function(){return $("#outputtext").text();} }); 
+4
source share
2 answers

The zclip ('show') function actually calls the jquery show method, not the Zclip function.

Another tip is to trigger a window resize or load event. You can see the function of binding to it in the code.

  a(window).bind("load resize", function(){ d.reposition() }) 

then every time I add / remove an item to my page, I call

 $(window).trigger('reload'); 

It does the trick for me.

+1
source

I believe that you can call the show method to update the position:

 $('#copyToClip').zclip('show'); 

The site says that "it cannot be 100% reliable in every case." and although this does not seem to be a problem in your case, it may be worth noting that it will not resize if the button has resized.

-1
source

Source: https://habr.com/ru/post/1390731/


All Articles