0

我有使用 slideToggle 的下拉菜单,并且在单击下拉菜单上添加了一些额外的效果,例如蒙版。我在下拉菜单的背景中显示模态类型的掩码。在点击侧我隐藏面具和拉菜单是切换和关闭(上拉)。但是我无法在单击 .puller 类时隐藏蒙版,因为我的菜单第二次切换并拉起,但背景蒙版没有隐藏。

$(".puller").click(function() {
    //Get the screen height and width
    var maskHeight = $(document).height();
    var maskWidth = $(window).width();
    //Set height and width to mask to fill up the whole screen
    $('#mask').css({'width':maskWidth,'height':maskHeight});
    //transition effect     
    $('#mask').fadeTo("slow",0.6);  
    $(".patientDetail").slideToggle();
 });

 $('#mask').click(function () {
    $(this).fadeTo("fast",0);   
    $(this).hide("fast");
    $(".patientDetail").slideToggle();
 }); 
4

1 回答 1

0

我已将代码更改为以下工作正常

$(".puller").click(function() {
    //Get the screen height and width
    var maskHeight = $(document).height();
    var maskWidth = $(window).width();
    //Set height and width to mask to fill up the whole screen
    $('#mask').css({'width':maskWidth,'height':maskHeight});
    //transition effect     
    $('#mask').fadeTo("slow",0.6);  
    $(".patientDetail").slideToggle(function() {
          if($(this).is(":hidden")) {
         alert("this was a slide up");
       } 
     });
 });
于 2011-02-02T12:54:42.607 回答