-
Notifications
You must be signed in to change notification settings - Fork 4
/
demo.htm
108 lines (76 loc) · 2.93 KB
/
demo.htm
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
101
102
103
104
105
106
107
108
<!doctype html>
<head>
<link rel="stylesheet" href="ddscrollspydemo.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script src="ddscrollspy.js">
/*
* DD ScrollSpy Menu Script (c) Dynamic Drive (www.dynamicdrive.com)
* Last updated: Dec 29th, 12'
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
*/
</script>
<script>
jQuery(function($){ // on document load
$('#horizontalmenu').ddscrollSpy({ // initialize first demo
scrolltopoffset: -50
})
$('#verticalspymenu').ddscrollSpy({ // initialize 2nd demo
spytarget: document.getElementById('contentcontainer'),
enableprogress: 'progress',
scrollduration: 300 // <-- no comma after last option!
})
})
function dynamicadditem(){ // function that dynamically adds a new menu item to first demo, spying on #para6
$('#verticalspymenu').append('<li><a href="#para5">Paragraph 5</a></li>')
$('#verticalspymenu').trigger('updatespy')
}
</script>
</head>
<body>
<!-- Scroll Spy Menu 1 -->
<ul id="horizontalmenu" class="underlinemenu">
<li><a href="#section1">Section 1</a></li>
<li><a href="#section2">Section 2</a></li>
<li><a href="#section3">Section 3</a></li>
<li><a href="#section4">Section 4</a></li>
<li><a href="#section5">Section 5</a></li>
</ul>
<!-- Scroll Spy Menu 2 -->
<div style="float:left; margin-right:15px; width:150px; margin-top: 120px">
<ul id="verticalspymenu" class="shadowblockmenu-v">
<li><a href="#para1">Paragraph 1</a></li>
<li><a href="#para2">Paragraph 2</a></li>
<li><a href="#para3">Paragraph 3</a></li>
<li><a href="#para4">Paragraph 4</a></li>
</ul>
<br />
<a href="javascript:dynamicadditem()" style="font-weight:bold">Click to dynamically add another menu item</a>
</div>
<!-- Contents that Scroll Spy Menu 2 is spying on -->
<div id="contentcontainer" style="width:500px; height:200px; overflow-y:scroll; border:1px solid gray; font:bold 18px Arial; float:left; background:yellow; position:relative; margin-top: 120px">
<p id="para1" style="height:400px; background:#d5e9b2">Paragraph 1</p>
<p id="para2" style="height:600px; background:#f7de90">Paragraph 2</p>
<p id="para3" style="height:700px; background:#9af5ed">Paragraph 3</p>
<p id="para4" style="height:500px; background:#fbd0e3">Paragraph 4</p>
<p id="para5" style="height:300px; background:#cbffe1">Paragraph 5</p>
</div>
<br style="clear:left" />
<!-- Contents that Scroll Spy Menu 1 is spying on -->
<div id="section1" style="height:300px;">
<h2>This is section 1</h2>
</div>
<div id="section2" style="height:400px;">
<h2>This is section 2</h2>
</div>
<div id="section3" style="height:700px;">
<h2>This is section 3</h2>
</div>
<div id="section4" style="height:600px;">
<h2>This is section 4</h2>
</div>
<div id="section5" style="height:1000px;">
<h2>This is section 5</h2>
</div>
<h2><a href="http://www.dynamicdrive.com/dynamicindex1/ddscrollspymenu.htm">DD ScrollSpy Menu Project Page</a></h2>
</body>
</html>