警报框未关闭

时间:2013-03-24 15:50:46

标签: javascript

请帮助使用此div警告框...它不会在点击事件中关闭

<script type="text/javascript">
    $(document).ready(function(){   
    $('.nof-close').click(function(){
            $('.afp-p-now').fadeOut();
            $('.afp-p-now').css('display','none');

        }); 

    }); 
    </script>

<div class="flash-messages container afp-p-now">
        <div class="flash flash-notice">Welcome to website...You are currently viewing me  
        <span class="mini-icon mini-icon-remove-close nof-close close"></span>
        </div>
        </div>

任何想法都会非常感激。谢谢。

1 个答案:

答案 0 :(得分:0)

这是因为没有任何内容可以点击,跨度没有内容。 试试这个:

<script type="text/javascript">
$(document).ready(function(){   
    $('.nof-close').click(function(){
        $('.afp-p-now').fadeOut();        
    });    
});
</script>
<div class="flash-messages container afp-p-now">
     <div class="flash flash-notice">Welcome to website...You are currently viewing me  
         <span class="mini-icon mini-icon-remove-close nof-close close">[Click here to close]</span>
     </div>
</div>

您还可以将范围更改为按钮(<button class="mini-icon mini-icon-remove-close nof-close close">Close</button>)。

相关问题