forked from malihu/malihu-custom-scrollbar-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scroll_buttons_and_snap_scrolling_examples.html
97 lines (84 loc) · 3.09 KB
/
scroll_buttons_and_snap_scrolling_examples.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
<!DOCTYPE html>
<!--[if IE 8 ]><html lang="en" class="ie8"><![endif]-->
<!--[if IE 9 ]><html lang="en" class="ie9"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>jQuery custom scrollbar demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- stylesheet for demo and examples -->
<link rel="stylesheet" href="style.css">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
<![endif]-->
<!-- custom scrollbar stylesheet -->
<link rel="stylesheet" href="../jquery.mCustomScrollbar.css">
</head>
<body>
<header>
<a href="http://manos.malihu.gr/jquery-custom-content-scroller/" class="logo"><img src="logo.png" alt="jQuery custom scrollbar" /></a>
<hr />
</header>
<div id="demo">
<section id="examples" class="snap-scrolling-example">
<!-- content -->
<div id="content-1" class="content horizontal-images">
<ul>
<li><img src="images/img1.jpg" /></li>
<li><img src="images/img2.jpg" /></li>
<li><img src="images/img3.jpg" /></li>
<li><img src="images/img4.jpg" /></li>
<li><img src="images/img5.jpg" /></li>
<li><img src="images/img6.jpg" /></li>
<li><img src="images/img7.jpg" /></li>
<li><img src="images/img1.jpg" /></li>
<li><img src="images/img2.jpg" /></li>
<li><img src="images/img3.jpg" /></li>
<li><img src="images/img4.jpg" /></li>
<li><img src="images/img5.jpg" /></li>
<li><img src="images/img6.jpg" /></li>
<li><img src="images/img7.jpg" /></li>
</ul>
</div>
</section>
</div>
<footer>
<hr />
<p><a href="http://manos.malihu.gr/jquery-custom-content-scroller">Plugin home</a> <a href="https://github.com/malihu/malihu-custom-scrollbar-plugin">Project on Github</a> <a href="http://opensource.org/licenses/MIT">MIT License</a></p>
</footer>
<!-- Google CDN jQuery with fallback to local -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../js/minified/jquery-1.11.0.min.js"><\/script>')</script>
<!-- custom scrollbar plugin -->
<script src="../jquery.mCustomScrollbar.concat.min.js"></script>
<script>
(function($){
$(window).load(function(){
/*
get snap amount programmatically or just set it directly (e.g. "273")
in this example, the snap amount is list item's (li) outer-width (width+margins)
*/
var amount=Math.max.apply(Math,$("#content-1 li").map(function(){return $(this).outerWidth(true);}).get());
$("#content-1").mCustomScrollbar({
axis:"x",
theme:"inset",
advanced:{
autoExpandHorizontalScroll:true
},
scrollButtons:{
enable:true,
scrollType:"stepped"
},
keyboard:{scrollType:"stepped"},
snapAmount:amount,
mouseWheel:{scrollAmount:amount}
});
});
})(jQuery);
</script>
</body>
</html>