MCPcopy
hub / github.com/lukehaas/Scrollify / scrollify

Function scrollify

jquery.scrollify.js:208–721  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

206 }
207 }
208 var scrollify = function(options) {
209 initialised = true;
210 $.easing['easeOutExpo'] = function(x, t, b, c, d) {
211 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
212 };
213
214 manualScroll = {
215 handleMousedown:function() {
216 if(disabled===true) {
217 return true;
218 }
219 scrollable = false;
220 scrolled = false;
221 },
222 handleMouseup:function() {
223 if(disabled===true) {
224 return true;
225 }
226 scrollable = true;
227 if(scrolled) {
228 //instant,callbacks
229 manualScroll.calculateNearest(false,true);
230 }
231 },
232 handleScroll:function() {
233 if(disabled===true) {
234 return true;
235 }
236 if(timeoutId){
237 clearTimeout(timeoutId);
238 }
239
240 timeoutId = setTimeout(function(){
241 scrolled = true;
242 if(scrollable===false) {
243 return false;
244 }
245 scrollable = false;
246 //instant,callbacks
247 manualScroll.calculateNearest(false,true);
248 }, 200);
249 },
250 calculateNearest:function(instant,callbacks) {
251 top = $(settings.target).scrollTop();
252 var i =1,
253 max = heights.length,
254 closest = 0,
255 prev = Math.abs(heights[0] - top),
256 diff;
257 for(;i<max;i++) {
258 diff = Math.abs(heights[i] - top);
259
260 if(diff < prev) {
261 prev = diff;
262 closest = i;
263 }
264 }
265 if((atBottom() && closest>index) || atTop()) {

Callers

nothing calls this directly

Calls 8

atBottomFunction · 0.85
atTopFunction · 0.85
animateScrollFunction · 0.85
isAcceleratingFunction · 0.85
getportHeightFunction · 0.85
interstitialScrollFunction · 0.85
sizePanelsFunction · 0.85
calculatePositionsFunction · 0.85

Tested by

no test coverage detected