Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dismiss panel in Bootstrap 3

I have the following code:

<div class="col-md-6">
    <div class="panel panel-primary copyright-wrap" id="copyright-wrap">
        <div class="panel-heading">
            Copyright Info
            <button type="button" class="close"
                    data-target="copyright-wrap"
                    data-dismiss="panel">
                <span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
            </button>
        </div>
        <div class="panel-body">
            &copy; some random dude
        </div>
    </div>
</div>

But for some reason it just doesn't work. Is a panel even dismissable? I found solutions for alerts and modals, but not for panels. Another person stated, that there is an undocumented feature ( How can I dismiss a bootstrap panel using data-dismiss? )

But that didn't work either.

Have a look at this JSFiddle

like image 372
DasSaffe Avatar asked Aug 27 '15 12:08

DasSaffe


2 Answers

As per Relequestual's code, it seems you were missing the hashtag in the target parameter, and the dismiss parameter was suppose to stay set to alert.

example: http://jsfiddle.net/y9yroaee/

like image 187
Zath Avatar answered Oct 30 '22 20:10

Zath


Please use this sample Code:

<div class="panel panel-default fade in collapse" id="demo" >
<div class="panel-heading"> <a data-toggle="collapse"   href="#demo"  class="close" >&times </a>
</div><div class="panel-body"></div></div>
like image 40
Meysam Ebrahimi Avatar answered Oct 30 '22 20:10

Meysam Ebrahimi