-
Notifications
You must be signed in to change notification settings - Fork 0
/
jQueryPractice.html
100 lines (76 loc) · 2.23 KB
/
jQueryPractice.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").toggle();
});
$("#click-target").click(function() {
alert("I was clicked");
});
$("#btn1").click(function() {
$("p").hide();
});
$("#btn2").click(function() {
$("p").show();
});
$("#slide-down").click(function() {
$("#slide").slideDown();
});
$("#slide-up").click(function() {
$("#slide").slideUp();
});
$("#slide-toggle").click(function(){
$("#slide-toggle-text").slideToggle("slow");
});
$("#fade-in").click(function() {
$("#fade-in-text").fadeIn(3000);
});
});
</script>
<style>
.box {
background-color: grey;
width: 700px;
}
.btn-style {
background-color: blue;
width: 300px;
height: 20px;
}
.text-style {
font-size: 16px;
font-family: Arial, Helvetica, sans-serif;
}
#slide-toggle-text {
display: none;
}
#fade-in-text {
display: none;
}
</style>
</head>
<body>
<h1>.click()</h1>
<p class="text-style" id="click-target">Click here.</p>
<h1>.hide()/.show()</h1>
<p class="text-style" id="hide-show-target">This is a paragraph.</p>
<button class="btn-style" id="btn1">Hide</button>
<button class="btn-style" id="btn2">Show</button>
<h1>.toggle()</h1>
<p class="text-style" id="">This is a paragraph.</p>
<button class="btn-style" id="toggle-btn">Toggle between hide() and show()</button>
<h1>.slideDown()/.slideUp()</h1>
<p class="text-style" id="slide">This is a paragraph.</p>
<button class="btn-style" id="slide-down">slide down</button>
<button class="btn-style" id="slide-up">slide up</button>
<h1>.slideToggle()</h1>
<button class="btn-style" id="slide-toggle">Click to slide the panel down or up</button>
<p class="text-style" id="slide-toggle-text">Hello, wolrd!</p>
<h1>.fadeIn()</h1>
<button class="btn-style" id="fade-in">Fade In</button>
<p class="text-style" id="fade-in-text">Hello, wolrd!</p>
</body>
</html>