-
Notifications
You must be signed in to change notification settings - Fork 46
/
js_scrollfire.html
128 lines (112 loc) · 3.51 KB
/
js_scrollfire.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
---
layout: admin
title: Javascript - ScrollFire
section: js
module: js_scrollfire
header:
icon: launch
title: ScrollFire
description: ScrollFire is a jQuery Plugin that executes callback functions depending on how far into the page you've scrolled. We'll show you how you can use this plugin with many demos and examples.
javascripts:
- js/pages/js_scrollfire.js
stylesheets:
- css/pages/js_scrollfire.css
---
<section id="js_scrollfire">
<!-- ############################ -->
<!-- jQuery Plugin Initialization -->
<!-- ############################ -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">jQuery Plugin Initialization</h4>
<pre>
<code class="language-javascript">
var options = [
{selector: '.class', offset: 200, callback: customCallbackFunc },
{selector: '.other-class', offset: 200, callback: function() {
customCallbackFunc();
}},
];
Materialize.scrollFire(options);
</code>
</pre>
</div>
</div>
<!-- ##################### -->
<!-- jQuery Plugin Options -->
<!-- ##################### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">jQuery Plugin Options</h4>
<table class="highlight">
<thead>
<tr>
<th>Option Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Selector</td>
<td>The selector for the element that is being tracked.</td>
</tr>
<tr>
<td>Offset</td>
<td>If this is 0, the callback will be fired when the selector element is at the very bottom of the user's window.</td>
</tr>
<tr>
<td>Callback</td>
<td>Execute a callback function when the user scrolls to the threshold. It will only be called once.</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- ############### -->
<!-- ScrollFire Demo -->
<!-- ############### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">ScrollFire Demo</h4>
<p>Scroll through slowly to get sense of what ScrollFire can do for you. This is the ScrollFire code that we have used on this page.</p>
<pre>
<code class="language-javascript">
var options = [
{selector: '#staggered-test', offset: 50, callback: function() {
Materialize.toast("This is our ScrollFire Demo!", 1500);
}},
{selector: '#staggered-test', offset: 205, callback: function() {
Materialize.toast("Please continue scrolling!", 1500);
}},
{selector: '#staggered-test', offset: 500, callback: function() {
Materialize.showStaggeredList("#staggered-test");
}}
];
Materialize.scrollFire(options);
</code>
</pre>
<ul class="margin-top-35" id="staggered-test">
<li>
<h5>List Item</h5>
<p>This is a description</p>
</li>
<li>
<h5>List Item</h5>
<p>This is a description</p>
</li>
<li>
<h5>List Item</h5>
<p>This is a description</p>
</li>
<li>
<h5>List Item</h5>
<p>This is a description</p>
</li>
<li>
<h5>List Item</h5>
<p>This is a description</p>
</li>
</ul>
</div>
</div>
</section>