2014-10-20 62 views
0

這裏真的很簡單的問題,我找不到它在文檔中,希望有人在這裏可以指出我在正確的方向。ZeroClipboard - 檢查它是否沒有加載

https://github.com/zeroclipboard/zeroclipboard

在ZeroClipboard有當SWF加載回調,是有辦法,如果它尚未加載我能察覺?

下面是它目前的工作方式時,它的加載:

client.on("ready", function(readyEvent) { 
    // alert("ZeroClipboard SWF is ready!"); 

    client.on("aftercopy", function(event) { 
    // `this` === `client` 
    // `event.target` === the element that was clicked 
    event.target.style.display = "none"; 
    alert("Copied text to clipboard: " + event.data["text/plain"]); 
    }); 
}); 

回答

1

只需選中ZeroClipboard對象是否在窗口存在

window.onload = function() { 
    if (!('ZeroClipboard' in window)) { 
     //your code 
    } 
}