2012-11-21 49 views

回答

0

有很多的這個插件上this page的文檔中的有用信息。 jQuery的東西是底部。

沒有使用插件,我不確定它是如何工作的,但我可以馬上發現你的'this'不是一個jQuery對象。嘗試:

$('#sb-container').swatchbook = function() { 
    $(this)._openclose() 
}); 

OR

$('#sb-container').swatchbook = function() { 
    _self._openclose() 
}); 

_self被聲明爲變量 '這個' 的插件:

var _self = this; 
+0

似乎並沒有工作。檢查文檔... – Dieter

0

closeIdx : 11行指定可以觸發事件上的項目。

$(function() { 
    $('#sb-container').swatchbook({ 
     // number of degrees that is between each item 
     angleInc : 15, 
     neighbor : 15, 
     // if it should be closed by default 
     initclosed : true, 
     // index of the element that when clicked, triggers the open/close function 
     // by default there is no such element 
     closeIdx : 11 
    }); 

}); 

function test(){ 
    $('.sb-toggle').trigger('click'); 
} 

HTML:

<div id="test" onclick="test();">Test</div> 
+0

我試圖讓它沒有內部切換鏈接工作,只是一個外部鏈接切換 – Dieter

相關問題