<style>
#mcs2_container{ width:100%; height:500px; background:#000; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=60);
 
     opacity:0.6; position:absolute; z-index:9999;}
#mcs2_container .customScrollBox{position:relative; width:500px; height:500px; background:#FFF; overflow:hidden; margin:auto;filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100);
 
     opacity: 1; background:#FFF;  }
</style>
<div id="mcs2_container" style=" visibility:hidden;">
<div class="customScrollBox">
</div>
</div>//JS代码
$(document).ready(function(){
点击中间不消失
$('.customScrollBox').click(function() {
$(this).parent().unbind('click');
});
点击旁边区域小时
$('#mcs2_container').click(function() {
$(this).css('visibility','hidden');
});
});
为什么我点击了中间 已经unbind  然后再点 旁边 不能重新绑定了。。想不通

解决方案 »

  1.   

    没明白楼主要表达什么,你点傍边又没有重新绑定的事件什么的,而且unbind后事件都没有了,还怎么执行
      

  2.   

    $(document).ready(function(){$('.customScrollBox').click(function(e) {
        e.stopPropagation();
    });$('#mcs2_container').click(function() {
        $(this).css('visibility','hidden');
    });
    });
      

  3.   

    给你改成另一种了,先显示再消失...
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
     <script src="jquery.js" type="text/javascript"></script>
    <style>
    #mcs2_container{ width:100%; height:500px; background:#000; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=60);
     
         opacity:0.6; position:absolute; z-index:9999;}
    #mcs2_container .customScrollBox{position:relative; width:500px; height:500px; background:#FFF; overflow:hidden; margin:auto;filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100);
     
         opacity: 1; background:#FFF;  }
    </style>
    <script type="text/javascript">
    //JS代码
    $(document).ready(function(){
    $('#mcs2_container').click(function() {
    $(this).css('display','none');
    });
    });
    //点击中间不消失
    $('.customScrollBox').click(function() {
    $(this).parent().unbind('click');
    });
    //点击旁边区域小时</script>
    </head>
    <body><div id="mcs2_container" style=" display:inline">
    <div class="customScrollBox">
    </div>
    </div>
    </body>
    </html>
      

  4.   

    这样呢?
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
     <script src="jquery.js" type="text/javascript"></script>
    <style>
    #mcs2_container{ width:100%; height:500px; background:#000; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=60);
     
         opacity:0.6; position:absolute; z-index:1;}
    #mcs2_container .customScrollBox{position:relative; width:500px; height:500px; background:#FFF; overflow:hidden; margin:auto;filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100);
     
         opacity: 1; background:#FFF;  z-index:2;}
    </style>
    <script type="text/javascript">
    //JS代码
    $(document).ready(function(){
    $('.customScrollBox').click(function(e) {
    e.stopPropagation();
    });
    $('#mcs2_container').click(function() {
    $(this).css('display','none');
    });
    });
    //点击中间不消失//点击旁边区域小时</script>
    </head>
    <body><div id="mcs2_container" style=" display:inline">
    <div class="customScrollBox">
    </div>
    </div>
    </body>
    </html>