-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy path9_jquery_effects.html
More file actions
46 lines (42 loc) · 1.11 KB
/
9_jquery_effects.html
File metadata and controls
46 lines (42 loc) · 1.11 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Q.9 jQuery Effects</title>
<!-- Include jQuery -->
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<style>
#myImage {
width: 200px;
height: 200px;
border: 1px solid #ccc;
margin-bottom: 10px;
}
</style>
</head>
<body>
<button id="showHideButton">Toggle Image</button>
<button id="fadeInOutButton">Fade In/Out</button>
<button id="stopButton">Stop Animation</button>
<img
id="myImage"
src="https://via.placeholder.com/200"
alt="Sample Image"
/>
<script>
// Show/Hide Effect
$('#showHideButton').on('click', function () {
$('#myImage').toggle('slow');
});
// Fade In/Out Effect
$('#fadeInOutButton').on('click', function () {
$('#myImage').fadeToggle('slow');
});
// Stop Animation
$('#stopButton').on('click', function () {
$('#myImage').stop();
});
</script>
</body>
</html>