使用Jquery覆盖的Bootstrap按钮单击事件

时间:2015-07-07 17:35:16

标签: jquery twitter-bootstrap

我正在使用Bootstrap 3和jQuery对新网站进行原型设计。

我遇到了按钮点击事件的问题,因为它只能运行一次。在jQuery中重写了Click事件,我认为这就是问题所在......不是jQuery,而是我对jQuery的了解。

HTML代码是......

<div class="row" id="bigCallout">

            <div class="col-md-12">

                <!-- Alert Block to show when Bloody Big Button pressed -->
                <div class="alert alert-success alert-block fade in" id="successAlert">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>

                    <h4>Success!</h4>
                    <p>You just made this element display by using jQuery. Click the 'x' to close this bad boy!</p>                     
                </div><!-- end alert-block -->

                <!-- Visible only on small devices -->
                <div class="well well-sm visible-sm">
                    <a href="#" class="btn btn-large btn-block btn-default"><span class="glyphicon glyphicon-phone"> Give Us a Call!</span></a>
                </div><!-- end well-sm -->
                <div class="well">
                    <div class="page-header">
                        <h1>A Fancy Header. <small>A subheading for extra awesomeness...dood!</small></h1>                  
                    </div><!-- end page-header -->
                    <p class="lead">Some catchy copy to get your users engaged . Use this area to come up with something nice and convincing.  Know what I'm saying?</p>

                    <!-- Bloody Big Button to set the alert Block -->
                    <a href="#" class="btn btn-large btn-primary" id='alertMe'>A Bloody Big Button</a>
                    <a href="#" class="btn btn-large btn-link">...or a secondary link</a>
                </div><!-- end well -->
            </div><!-- end col-md-12 -->

        </div><!-- end bigCallout -->

按钮点击的jQuery代码是......

$(function(){

 //Big Button click event
  $("#alertMe").click(function(e){
        e.preventDefault();

        $("#successAlert").slideDown();
    });
});

此时此操作只能进行一次,我需要帮助才能重复播放而不刷新屏幕。

0 个答案:

没有答案