我有一个以酒吧开始的弹出窗口。酒吧里有一个圆圈。当您单击该栏时,它会弹出。我想在圆圈和可点击的栏之间交替 - 圆圈应该关闭弹出窗口,栏应该打开弹出窗口。我似乎无法弄清楚为什么我可以将函数 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);});