"Learning jQuery"
Bootstrap 3.3.0 Snippet by IonAVBenson

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
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<h2>Learning jQuery</h2>
<button type="button" class="btn btn-primary">Primary</button> <br><br>
<class id="#div1" style="width:80px;height:80px;display:none;background-color:red;"></class>
<br>
<div id="#div2" style="width:80px;height:80px;display:none;background-color:green;"></div>
<br>
<div id="#div3" style="width:80px;height:80px;display:none;background-color:blue;"></div>
<br>
<div id="#div4" style="width:80px;height:80px;display:none;background-color:orange;"></div>
<br>
<div id="#div5" style="width:80px;height:80px;display:none;background-color:purple;"></div>
<br>
<div id="#div6" style="width:80px;height:80px;display:none;background-color:black;"></div>
</div>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
h2{
color: red}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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
$(document).ready(function(){
$("button").click(function(){
$("#div1").fadeIn(1000);
$("#div2").fadeIn(2000);
$("#div3").fadeIn(3000);
$("#div4").fadeIn(4000);
$("#div5").fadeIn(5000);
$("#div6").fadeIn(6000);
$("#div1").fadeOut(6000);
$("#div2").fadeOut(5000);
$("#div3").fadeOut(4000);
$("#div4").fadeOut(3000);
$("#div5").fadeOut(2000);
$("#div6").fadeOut(1000);
});
});
$(function () {
var $element = $('class');
setInterval(function () {
$element.fadeIn(1000).delay(2000).fadeOut(1500).delay(2000).fadeIn(1500);
}, 5000);
});
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: