0

请帮助这个 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>

任何想法将不胜感激。谢谢。

4

1 回答 1

0

那是因为没有什么可以点击的,span没有内容。尝试这个:

<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>)。

于 2013-03-25T10:17:35.053 回答