2012-07-06 40 views
0

我正在使用zclip複製到剪貼板功能,直到我開始使用twitter bootstrap css框架。 現在我似乎無法再使用zclip了,有沒有人有解決方案?zclip&twitter bootstrap:不兼容?

一些測試結果:

這是我如何使用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> 

但每當我嘗試使用的圖像,它不再工作,閃光的東西不會出現:

<div class='test'><img src="{{ asset('bundles/yopyourownpoet/images/Star.png') }}" alt="Star" height="100" width="100" /></div> 

在我開始使用引導程序之前,這工作得很好... 使用zclip的任何提示& bootstrap,並在圖像上有閃光的東西? 非常感謝。

回答

2

那麼,經過很多嘗試,我終於有它的工作。我不得不恢復到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的圖像上,使閃光的是與圖像疊加。

這是行之有效的,只是光標並不總是在鼠標懸停圖像時更改爲指針。

雖然我覺得這個解決方案有點不好意思,所以如果有人有更好的解決方案,請分享。