たとえば、次のスウォッチブック関数で「._openclose()」を実行するにはどうすればよいですか?
http://tympanus.net/Tutorials/SwatchBook/index3.html
私は次のようなものを試しました:
$( '#sb-container' ).swatchbook = function () {
    this._openclose()
}
    たとえば、次のスウォッチブック関数で「._openclose()」を実行するにはどうすればよいですか?
http://tympanus.net/Tutorials/SwatchBook/index3.html
私は次のようなものを試しました:
$( '#sb-container' ).swatchbook = function () {
    this._openclose()
}
    このページのこのプラグインのドキュメントには、役立つ情報がたくさんあります。jQueryのものは下に向かっています。
プラグインを使用していないと、プラグインがどのように機能するかはわかりませんが、「this」はjQueryオブジェクトではないことがすぐにわかります。試す:
$( '#sb-container' ).swatchbook = function () {
    $(this)._openclose()
}); 
また
$( '#sb-container' ).swatchbook = function () {
    _self._openclose()
});
_selfは、プラグインで変数'this'として宣言されています。
var _self = this; 
    行で指定されているように、アイテムに対してイベントをトリガーできます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>