Skip to content

Commit 2c022d7

Browse files
committed
New example plus use Bootstrap
1 parent 338a18f commit 2c022d7

File tree

6 files changed

+94
-26
lines changed

6 files changed

+94
-26
lines changed

examples/dynamic-menu.html

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<!Doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
6+
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
7+
<title>Scrollable: Dynamic Menus</title>
8+
9+
<script src="http://code.jquery.com/jquery.js"></script>
10+
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
11+
12+
<script src="../jquery-ui-scrollable.js"></script>
13+
14+
15+
</head>
16+
<body>
17+
18+
<div class="menu">
19+
20+
<nav class="navbar navbar-inverse navbar-fixed-top">
21+
<ul class="nav navbar-nav nav-main">
22+
<li class="active"><a href="#">Item 1</a></li>
23+
<li><a href="#">Item 2</a></li>
24+
<li><a href="#">Item 3</a></li>
25+
</ul>
26+
</nav>
27+
28+
<nav class="navbar navbar-default navbar-static-top" style="margin-top: 50px; ">
29+
<div class="navbar-form navbar-left nav-search" style="top: 0; width: 50%; z-index: 2000;">
30+
<div class="input-group">
31+
<input type="text" class="form-control" placeholder="Search">
32+
<span class="input-group-btn">
33+
<button class="btn btn-default" type="button">Go!</button>
34+
</span>
35+
</div>
36+
</div>
37+
</nav>
38+
39+
</div>
40+
41+
<a href="https://github.com/bseth99/jquery-ui-scrollable"><img style="position: fixed; top: 0; right: 0; border: 0; z-index: 2000;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
42+
43+
<div style="position: fixed; right: 150px; top: 150px; width: 500px; margin: 10px; ">
44+
45+
<div>
46+
<a href="../index.html">&lt; Back to widget demos</a>
47+
</div>
48+
<br/>
49+
50+
The demo illustrates how to use the Scrollable widget to create a dynamic menu that folds up/down as the page is
51+
scrolled. The content is setup in a way that the submenu slides behind the main menu and, once out of view, its
52+
contents become visible in the main menu bar. The solution does require calculating all the fixed positions
53+
of the menu items since they are not moved from their original parent.
54+
</div>
55+
56+
<div style="height: 2000px;">
57+
</div>
58+
59+
<script>
60+
$(function () {
61+
$search = $( '.nav-search' );
62+
63+
$('.menu')
64+
.on('scrollin', function ( e, ui) {
65+
66+
$search.css({
67+
position: 'absolute',
68+
left: '0',
69+
width: '50%'
70+
}).parent().css( 'position', 'relative' );
71+
72+
})
73+
.on('scrollout', function ( e, ui) {
74+
75+
$search.css({
76+
position: 'fixed',
77+
left: '230px',
78+
width: '30%'
79+
}).parent().css( 'position', 'static' );
80+
81+
})
82+
.scrollable({ offset: { top: 50 } });
83+
84+
});
85+
</script>
86+
87+
</body>
88+
</html>

examples/event.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
5+
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
66

77
<title>Scrollable: Basic Events with Multiple Containers</title>
88

@@ -11,11 +11,6 @@
1111

1212
<script src="../jquery-ui-scrollable.js"></script>
1313

14-
<style>
15-
body {
16-
font-family: sans-serif,arial;
17-
}
18-
</style>
1914
</head>
2015
<body>
2116

examples/goto.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
5+
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
66

77
<title>Scrollable: Use the Goto Method to Animate Scrolling to the Element</title>
88

@@ -11,12 +11,6 @@
1111

1212
<script src="../jquery-ui-scrollable.js"></script>
1313

14-
15-
<style>
16-
body {
17-
font-family: sans-serif,arial;
18-
}
19-
</style>
2014
</head>
2115
<body>
2216

examples/offset.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
5+
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
66

77
<title>Scrollable: Adjust Logical Viewport Size with Offset Option</title>
88

@@ -11,11 +11,6 @@
1111

1212
<script src="../jquery-ui-scrollable.js"></script>
1313

14-
<style>
15-
body {
16-
font-family: sans-serif,arial;
17-
}
18-
</style>
1914
</head>
2015
<body>
2116

examples/slideshow.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
5+
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
66

77
<title>Scrollable: Image Slideshow</title>
88

@@ -12,10 +12,6 @@
1212
<script src="../jquery-ui-scrollable.js"></script>
1313

1414
<style>
15-
body {
16-
font-family: sans-serif,arial;
17-
}
18-
1915
.main {
2016
width: 800px;
2117
margin: auto;

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
65

76
<title>jQuery UI Scrollable Widget</title>
87

@@ -13,7 +12,7 @@
1312

1413
<style>
1514
body {
16-
font-family: sans-serif,arial;
15+
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
1716
}
1817

1918
pre {
@@ -258,6 +257,7 @@ <h1>Demos</h1>
258257
<li><a href="examples/goto.html">Animated Scroll with Goto Method</a></li>
259258
<li><a href="examples/offset.html">Adjust Viewport Size with Offset</a></li>
260259
<li><a href="examples/slideshow.html">Create a Simple Image Slideshow</a></li>
260+
<li><a href="examples/dynamic-menu.html">Dynamically Collaping Menu</a></li>
261261
</ul>
262262
</div>
263263

0 commit comments

Comments
 (0)