首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我已经用slideToggle创建了下拉模式,但切换功能没有隐藏模式掩码

问我已经用slideToggle创建了下拉模式,但切换功能没有隐藏模式掩码
EN

Stack Overflow用户
提问于 2011-02-01 05:06:20
回答 1查看 589关注 0票数 0

我有使用slideToggle的下拉菜单,我正在添加一些额外的效果,如点击下拉菜单上的蒙版。我在下拉菜单的背景中显示了一种模式蒙版。在点击out side时,我隐藏了遮罩,拉菜单是切换和关闭(pull up)。但是我不能在点击.puller类的时候隐藏遮罩,第二次我的菜单被切换和弹出,但是背景遮罩没有隐藏。

代码语言:javascript
复制
$(".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();
 }); 
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-02-02 20:54:43

我已经修改了下面的代码,它工作正常

代码语言:javascript
复制
$(".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");
       } 
     });
 });
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4856092

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档