Zurb Foundation 5关闭一个带有个人按钮的警报框

时间:2013-12-04 21:33:14

标签: alert zurb-foundation-5

我想“扩展”警告框,例如有一个确认框或提示框,但我还想继续使用靠近数据库中的商店信息的回调函数。

我的警报框的结构可能是这样的:

<div data-alert class="alert-box success">
    <a href="#" class="close">&times;</a>
    <h4>This is a <span class="bold">title</span></h4>
    <p>This is an error alert a bit more complex.</p>
    <p>
        <a href="#" class="button alert-box-close">Close</a>
        <a href="#" class="button alert">Cancel</a>
    </p>
</div>

我遇到的问题是.alert-box-close类如何像.close类一样工作?

Thanx求助

3 个答案:

答案 0 :(得分:1)

使用jquery隐藏警告框

   <div data-alert class="alert-box">
   <!-- Your content goes here -->
   <a href="#" id="closebutton" class="alert button">close</a>
   </div>

和jquery是,

   $( "#closebutton" ).click(function() {
      $(this).parent().hide();
   });

答案 1 :(得分:1)

转到文件(如果您单独加载每个模块)

foundation.alert.js

第23行

$(this.scope).off('.alert').on('click.fndtn.alert', '[' + this.attr_name() + '] a.close', function (e) {

你就这样做了

$(this.scope).off('.alert').on('click.fndtn.alert', '[' + this.attr_name() + '] a.close, .any-class-name', function (e) {

答案 2 :(得分:0)

这种方式适合我。

$(".alert-box .close").click(function(e) {
    e.preventDefault();
    $(this).parent().hide();
});

再次展示之前,可以这样做:

$(".alert-box")
                    .removeClass("alert-close")
                    .removeClass("hide")
                    .addClass("success")
                    .show();
相关问题