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

强颜欢笑 提交于 2019-12-10 15:22:18

问题


I am currently using the zclip/jquery code to allow copying to the clipboard. It is currently attached to a span button. It seems to use a swf file over the button to provide the flash based copy to clipboard feature. The problem that I have is that when I dynamically add new elements to the page, the button position moves down but the SWF position stays the same. Is there anything I can do to have the zclip "follow" the button? Zclip snippet below:

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

回答1:


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

An other tip would be to trigger the window resize or load event. You can see in the code the reposition function is bound to it.

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

then everytime, I add/remove element to my page, I call

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

That does the trick for me.




回答2:


I beleive you can call the 'show' method to refresh the position:

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

The site does say "it may not be 100% reliable in every instance." and although it doesn't sound like it'll be an issue in your case it might be worth noting that it won't resize itself if the button has changed size.



来源:https://stackoverflow.com/questions/8842977/zclip-swf-does-not-align-with-button-position-if-button-position-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!