"Close Panel Effects"
Bootstrap 3.1.0 Snippet by dwhite440

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<head>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
</head>
<div class="container">
<div class="row">
<div class="jumbotron">
<h2>Close Panel With Button</h2>
<p>You can use jQuery Effects to close away you Panel using the data-effect and name it how you want to.</p>
</div>
</div>
<div class="row">
<div class="col-md-3 col-sm-6 col-xs-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Using Fade Out</h3>
<!-- Watch Out: Here We must use the effect name in the data tag-->
<span class="pull-right clickable" data-effect="fadeOut"><i class="fa fa-times"></i></span>
</div>
<div class="panel-body">
Panel content
</div>
<div class="panel-footer">
Panel footer
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-6">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">Using Slide Up</h3>
<!-- Watch Out: Here We must use the effect name in the data tag-->
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
.panel-heading span
{
margin-top: -26px;
font-size: 15px;
margin-right: -12px;
}
.clickable {
background: rgba(0, 0, 0, 0.15);
display: inline-block;
padding: 6px 12px;
border-radius: 4px;
cursor: pointer;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
$(function(){
$('.clickable').on('click',function(){
var effect = $(this).data('effect');
$(this).closest('.panel')[effect]();
})
})
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: