2013-01-04 32 views
0

進出口使用一個名爲Embedly LINK觸發的服務代碼的服務是這樣的:做一個功能Embedly

$('div#result').embedly({ 
     key: ':3eccf441bf0f43acbb076da9817af27d' 

    }); 

我也有這樣的功能:

function remove() {  
var seen = {}; 
$('.embed').each(function() { 
    var txt = $(this).html(); 
    if (seen[txt]) 
     $(this).remove(); 
    else 
     seen[txt] = true; 
}); 
} 

所以我想把這個功能嵌入到內嵌中,我試過了:

$('div#result').embedly({ 
     key: ':3eccf441bf0f43acbb076da9817af27d', 
     remove() 

    }); 

但它不起作用。我也嘗試過:

$('div#result').embedly({ 
     key: ':3eccf441bf0f43acbb076da9817af27d', 
     success: function() { 
     remove() 
     } 

    }); 

沒有運氣。如何在嵌入呼叫之後或之後執行我的功能?

回答

1

在一些它的外觀examples的外形像你只需要將該功能移動到了選項列表中,這樣的:

$('div#result').embedly(
    // options 
    { 
     key: ':3eccf441bf0f43acbb076da9817af27d' 
    }, 
    // "success" function 
    function(oembed, dict) { 
     remove(); 
    } 
); 
+0

嗨,這並沒有爲我工作,但基於鏈接你提供了我發現的anwser,謝謝:) – Youss

+0

這是代碼我使用的情況下,你感興趣的:\t'$(「#result」)。embedly({key:'3eccf441bf0f43acbb076da9817af27d' })。bind('embedly功能(e){ \t \t \t \t \t \t \t remove(); });' – Youss