-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFadeIn&FadeOut.html
More file actions
39 lines (39 loc) · 947 Bytes
/
FadeIn&FadeOut.html
File metadata and controls
39 lines (39 loc) · 947 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>FadeIn&FadeOut</title>
<script src="jquery-3.2.1.min.js"></script>
<script>
$(document).ready(function() {
$('p.more').hide();
$('a.short').hide();
$('a.more').click(function() {
$('p.more').fadeIn('1500');
$(this).hide();
$('a.short').show();
return false; // 停止超連結的預設行為
});
$('a.short').click(function() {
$('p.more').fadeOut('1500');
$('a.more').show();
$(this).hide();
return false;
});
$('a.toggle').click(function() {
$('p.more').fadeToggle('1500');
return false;
});
});
</script>
</head>
<body>
<div>
<p>jQuery is a JavaScript function library.</p>
<p class="more">jQuery was invented in 2006 by John Resig at BarCamp.</p>
<a href="#" class="more">More</a>
<a href="#" class="short">Hidden Info</a>
<a href="#" class="toggle">Switch</a>
</div>
</body>
</html>