0

バーとして始まるポップアウトがあります。バーにサークルがあります。バーをクリックするとポップアウトします。クリック可能な円とバーを交互に使用したい - 円はポップアウトを閉じ、バーはポップアウトを開く必要があります。関数 dBind をコードの下部近くで通常どおりバインドできる理由がわかりませんが、関数内でバインドしようとすると、バインドしている関数が呼び出され、最終的に目的が果たせなくなります。

function circBind(elem){
        var thisDrawer = $(elem).parent();
        var toggleWidth = thisDrawer.width() == 450 ? "25px" : "450px";
        thisDrawer.animate({ width: toggleWidth }).css('overflow', 'visible');
        if (thisDrawer.is("#bottom-drawer")) {
                $
                label = thisDrawer.find('.drawer-label');
                if($(label).is(":visible")){
                }else{
                    $('.search-drawer').bind('click',function(){dBind(this);});
                    $(label).show();
                    var thisPlaylist = $('#site-playlist');
                    $('.playlist-nav').hide();
                    $('.playlist-block').hide();
                    thisPlaylist.hide();    
                }
        }
        if (thisDrawer.is("#top-drawer")) {
                $('.music-list').hide();
                label.hide();
        }
    alert("cc");
    $('.search-circle').unbind('click');
};


function dBind(elem) {
        var thisDrawer = $(elem);
        var toggleWidth = thisDrawer.width() == 450 ? "25px" : "450px";
        thisDrawer.animate({ width: toggleWidth }).css('overflow', 'visible');
        if (thisDrawer.is("#bottom-drawer")) {
                label = thisDrawer.find('.drawer-label');
            if($(label).is(":visible")){
                var thisPlaylist = $('#site-playlist');
                $('.playlist-nav').show();
                $(label).hide();
                thisPlaylist.fadeIn('slow');
                $('.search-circle').bind('click',function(){circBind(this);});
                alert("dc");
            }
        }
        if (thisDrawer.is("#top-drawer")) {
                label = thisDrawer.find('.drawer-label');
                $('.music-list').fadeIn('slow');
                $(label).show();
        }


    $('.search-drawer').unbind('click');
};

$('.search-drawer').bind('click',function(){dBind(this);});
4

1 に答える 1

0

既にお気付きかもしれませんが、circBind 関数の $ 自体は何ですか?

于 2013-09-17T04:38:27.920 に答える