-
-
Notifications
You must be signed in to change notification settings - Fork 208
/
demo.html
225 lines (216 loc) · 14.4 KB
/
demo.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AnimateScroll Demo</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="Ram Swaroop" />
<link rel="stylesheet" type="text/css" href="custom.css" />
<script src="jquery-1.8.3.min.js"></script>
<script src="animatescroll.js"></script>
</head>
<body>
<div class="container">
<header>
<h1>AnimateScroll Demo<span>A Simple jQuery Plugin for Animating Scroll</span></h1>
</header>
<div class="main clearfix">
<nav id="menu" class="nav">
<ul>
<li>
<a href="http://plugins.compzets.com" >
<span class="icon">
<i aria-hidden="true" class="icon-home"></i>
</span>
<span>Home</span>
</a>
</li>
<li>
<a href="#" onclick="$('#section-2').animatescroll();">
<span class="icon">
<i aria-hidden="true" class="icon-services"></i>
</span>
<span>What is it?</span>
</a>
</li>
<li>
<a href="#" onclick="$('#section-3').animatescroll();">
<span class="icon">
<i aria-hidden="true" class="icon-portfolio"></i>
</span>
<span>Options</span>
</a>
</li>
<li>
<a href="#" onclick="$('#section-4').animatescroll();">
<span class="icon">
<i aria-hidden="true" class="icon-blog"></i>
</span>
<span>Easing Effects</span>
</a>
</li>
<li>
<a href="#" onclick="$('#section-5').animatescroll();">
<span class="icon">
<i aria-hidden="true" class="icon-team"></i>
</span>
<span>Usage</span>
</a>
</li>
<li>
<a href="#" onclick="$('#section-6').animatescroll();">
<span class="icon">
<i aria-hidden="true" class="icon-contact"></i>
</span>
<span>About Me</span>
</a>
</li>
</ul>
</nav>
</div>
</div><!-- /container -->
<div class="main clearfix">
<div id="section-2">
<div class="content-wrapper w70">
<h1>What is it exactly?</h1>
<p><strong>AnimateScroll</strong> is a jQuery plugin which enables you to <strong>scroll to any part of the page
in style</strong> by just calling the <code>animatescroll()</code> function with the <code>Id</code> or <code>Classname</code>
of the element where you want to scroll to.</p>
<p><strong>Basic usage:</strong></p>
<pre><code class="language-javascript">$('body').animatescroll();</code></pre>
<button class="btn demo-btn" onclick="$('body').animatescroll();">Click for a Demo</button>
<p>
It gives power to the user with its various options to customize the style of scrolling, scroll speed and many more.
Supports more than 30 unique Scrolling Styles.
</p>
</div>
</div>
<div id="section-3">
<div class="content-wrapper w70">
<h1>Options</h1>
<p>AnimateScroll has 6 options:</p>
<ul>
<li>easing</li>
<li>scrollSpeed</li>
<li>padding</li>
</ul>
<p><strong>easing : </strong> This option defines the scrolling style. The various easing effects supported can be seen at <a href="http://easings.net" target="_blank">easings.net</a> <small>(Accepts string only)</small></p>
<p><strong>scrollSpeed : </strong> Controls the scrolling speed, higher is the number slower is the scroll speed <small>(Accepts only number)</small></p>
<p><strong>padding : </strong> Adjusts little ups and downs in scrolling. Suppose a small amount of padding is applied to a particular element due to which the scroll didn't end at the right position, so this option helps you to rectify <small>(Accepts numbers only, can be negative)</small></p>
<!-- Added in 1.0.5 -->
<h1>Added in v1.0.5</h1>
<p>4<sup>th</sup> option:</p>
<ul>
<li>element</li>
</ul>
<p><strong>element : </strong> The element in which you want this plugin to work. Default is "body". <small>(Accepts any jQuery/CSS selector)</small></p>
<div>
For Example:<br/>
<div class="element-demo">
<p>
<button onclick="$('#last-paragraph').animatescroll({element:'.element-demo',padding:20});">Click here</button> to scroll to the last paragraph within this "div" element
</p>
<p>
This "div" element has a class-name "element-demo" which is the value passed for "element" option while calling the plugin.
</p>
<p>
Compzets.com is India's first open source software and freeware publishing site, Download and Upload Open source software and Freeware relevant to the Paid ones for PC,Mac and Linux.
</p>
<p >
It also makes its own Cloud Applications for making tasks easy. Recently it has launched a new Plugin Showcase too.
</p>
<p>
This website is your source of unprecedented access to all kinds of pc,mac or linux software (Open Source or Freeware only) with detailed coverage of tech infos along with multiple screen shots and moreover you can not only download your favorite gadgets but you can also UPLOAD your own software to reach thousand of audience. Stay connected to all the latest happenings in the gadget world,with regular updates on new software and announcements with the help of our RSS Feed,just at a few clicks!
</p>
<p id="last-paragraph">
The word "Compzets" does not have a literal meaning,it is just derived from the word Gadget which is related to Electronic devices where as Compzets is related to Computer software which are nothing but gadgets for computer.
</p>
<p>
Thanks to <a href="https://plus.google.com/114685591029748634833" target="_blank">Ronan DMP</a> for asking this feature!
</p>
</div>
</div>
The Code is like:<br/>
<pre class="language-javascript"><code class="language-javascript">$('#last-paragraph').animatescroll({element:'.element-demo',padding:20});</code></pre>
<!-- Added in 1.0.7 -->
<h1>Added in v1.0.7</h1>
<p>2 more options:</p>
<ul>
<li>onScrollStart</li>
<li>onScrollEnd</li>
</ul>
<p><strong>onScrollStart : </strong> A function to be called before scrolling starts</p>
<p><strong>onScrollEnd : </strong> A function to be called after the scrolling ends completely with animations</p>
The Code will be like:<br/>
<pre class="language-javascript"><code class="language-javascript">$('#target-element').animatescroll({onScrollStart:function(){alert('scroll started')},onScrollEnd:function(){alert('scroll ended')}});</code></pre>
</div>
</div>
<div id="section-4">
<div class="content-wrapper w60 disp_inl_blk">
<h1>Easing Effects</h1>
<p>This plugin supports more than 30 different styles of scrolling. The easing option lets you choose a particular style of scrolling according to your choice.</p>
<p>Some of them are shown here:</p>
<pre><code class="language-javascript">$('#section-2').animatescroll({scrollSpeed:2000,easing:'easeInOutBack'});</code></pre>
<pre><code class="language-javascript">$('#section-2').animatescroll({scrollSpeed:2000,easing:'easeOutBounce'});</code></pre>
<pre><code class="language-javascript">$('#section-2').animatescroll({scrollSpeed:3000,easing:'easeOutElastic'});</code></pre>
<pre><code class="language-javascript">$('#section-2').animatescroll({padding:-100});</code></pre>
</div>
<div class="content-wrapper w30 fr">
<div class="easing-buttons">
<strong>Click the buttons below for a demo:</strong><br/><br/>
<button class="btn" onclick="$('#section-2').animatescroll({scrollSpeed:2000,easing:'easeInOutBack'});">easeInOutBack</button><br/><br/>
<button class="btn" onclick="$('#section-2').animatescroll({scrollSpeed:2000,easing:'easeOutBounce'});">easeOutBounce</button><br/><br/>
<button class="btn" onclick="$('#section-2').animatescroll({scrollSpeed:3000,easing:'easeOutElastic'});">easeOutElastic</button><br/><br/>
<button class="btn" onclick="$('#section-2').animatescroll({padding:-100});">with padding</button>
</div>
</div>
</div>
<div id="section-5" onclick="$('#section-1').animatescroll({scrollSpeed:3000,padding:-30,easing:'easeOutElastic'});">
<div class="content-wrapper w60 disp_inl_blk">
<h1>Usage</h1>
<p>You need two things for this plugin to work, one is <strong>"jQuery library"</strong> and the other <strong>"animatescroll.js"</strong> file</p>
<p>Just include the "animatescroll.js" file after the "jQuery library" as shown in the code snippet below and you're done</p>
<small>NOTE: The only dependency for this plugin to work is jQuery library</small>
<pre class="language-markup">
<code class="language-markup" >
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="animatescroll.js">
</head>
<body>
<div id="section-1">This is the element where you want to scroll to<div>
/*
* You may call the function like this
* (but better attach an event listener)
*/
<a onclick="$('[jquery selector]').animatescroll([options]);">Go to Element</a>
</body>
</html>
</code>
</pre>
</div>
<div class="content-wrapper w30 fr">
<div class="download-buttons">
<button class="btn" onclick="window.location='http://plugins.compzets.com/animatescroll'">Download</button><br/><br/>
<button class="btn" onclick="window.location='https://github.com/ramswaroop/animatescroll.js'">Download from github</button>
</div>
</div>
</div>
<div id="section-6">
<div class="content-wrapper w70 disp_inl_blk">
<h1>About Me</h1>
<p>My name is <a href="http://www.ramswaroop.me" target="_blank">Ram Swaroop</a>. I am a Programmer as well as a Designer. I am the Founder of <a href="http://www.compzets.com" target="_blank">Compzets.com</a>, as well as various other <a href="http://webapps.compzets.com" target="_blank">online applications</a>.</p>
<p>This is my first jQuery Plugin and I hope you all like it. You are free to make more improvements to the code and can do the same <a href="https://github.com/ramswaroop/animatescroll.js" target="_blank">@github</a>.</p>
<p>If my plugin helped you or unlikely for any issues tweet me <a href="https://twitter.com/ramswarooppatra" target="_blank">@ramswaroopatra</a>, will be happy to hear from you.</p>
</div>
<div class='content-wrapper w30 fr'>
<a onclick="$('body').animatescroll();" class='ptr fr'><small>Go to Top</small></a>
</div>
</div>
</div>
</body>
</html>