在我开始使用twitter bootstrap css框架之前,我一直在成功地使用zclip复制到剪贴板功能。现在我似乎不能再使用zclip了,有没有人有解决方案呢?
一些测试结果:
下面是我如何使用zclip的:
$('.test').zclip({
path:"{{ asset('bundles/yopyourownpoet/flash/ZeroClipboard.swf') }}",
copy: 'test',
afterCopy:function(){
alert('The poem has been copied to the clipboard.');
},
});这与以下html很好地配合使用:
<div class='test'>test</div>但每当我尝试使用图像时,它就不再起作用,flash的东西就不会出现:
<div class='test'><img src="{{ asset('bundles/yopyourownpoet/images/Star.png') }}" alt="Star" height="100" width="100" /></div>在我开始使用bootstrap之前,它工作得很好……有没有什么建议可以使用zclip & bootstrap,并在图像上使用flash的东西?非常感谢。
发布于 2012-07-08 11:39:12
嗯,经过多次尝试,我终于让它工作了。我不得不恢复到zeroclipboard,并且不再使用zclip。以下是正在运行的代码:
<div id="d_clip_container" style="position:relative; bottom: 25px; display: inline;">
<img id='d_clip_button' style="position:relative; top: 25px;" src="{{ asset('bundles/yopyourownpoet/images/CopyPoemPage8.png') }}" alt="Copy Poem" height="71" width="300" />
</div>-
ZeroClipboard.setMoviePath("{{ asset('bundles/yopyourownpoet/flash/ZeroClipboard.swf') }}");
var clip = new ZeroClipboard.Client();
clip.setText( 'text to copy' );
clip.glue( 'd_clip_button', 'd_clip_container' );
clip.setHandCursor( true );请注意,我必须使用一个技巧,容器上的底部25px和图像上的顶部25px,以便flash的东西与图像叠加。
这工作得很好,除了在悬停图像时光标并不总是变为指针。
我认为这个解决方案有点可疑,所以如果有人有更好的解决方案,请分享它。
https://stackoverflow.com/questions/11355385
复制相似问题