vendor: 26,449 bytes, lines 1-883
1//Skip to content 2//Why GitHub? 3//Enterprise 4//Explore 5//Marketplace 6//Pricing 7//Search 8// 9//Sign in 10//Sign up 11//93 1,636 540 lukehaas/Scrollify 12// Code Issues 106 Pull requests 17 Projects 0 Security Insights 13//All your code in one place 14//GitHub makes it easy to scale back on context switching. Read rendered documentation, see the history of any file, and collaborate with contributors on projects across GitHub. 15// 16// See pricing for teams and enterprises 17//Scrollify/jquery.scrollify.js 18//@lukehaas lukehaas update version 19//bd77b5d on 24 Mar 20//@lukehaas @JesseHigson @xPh03n1x @steveeakin @SpeakInCode @RossMerriam @martinczerwi @markcarlson @eljay040 @dominicfallows @christingruber @zhangxh6931 21//854 lines (777 sloc) 25.8 KB 22// 23/*! 24 * jQuery Scrollify 25 * Version 1.0.20 26 * 27 * Requires: 28 * - jQuery 1.7 or higher 29 * 30 * https://github.com/lukehaas/Scrollify 31 * 32 * Copyright 2016, Luke Haas 33 * Permission is hereby granted, free of charge, to any person obtaining a copy of 34 * this software and associated documentation files (the "Software"), to deal in 35 * the Software without restriction, including without limitation the rights to 36 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 37 * the Software, and to permit persons to whom the Software is furnished to do so, 38 * subject to the following conditions: 39 * 40 * The above copyright notice and this permission notice shall be included in all 41 * copies or substantial portions of the Software. 42 * 43 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 44 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 45 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 46 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 47 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 48 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 49if touchScroll is false - update index 50 */ 51(function (global,factory) { 52 "use strict"; 53 if (typeof define === 'function' && define.amd) { 54 // AMD. Register as an anonymous module. 55 define(['jquery'], function($) { 56 return factory($, global, global.document); 57 }); 58 } else if (typeof module === 'object' && module.exports) { 59 // Node/CommonJS 60 module.exports = factory(require('jquery'), global, global.document); 61 } else { 62 // Browser globals 63 factory(jQuery, global, global.document); 64 } 65}(typeof window !== 'undefined' ? window : this, function ($, window, document, undefined) { 66 "use strict"; 67 var heights = [], 68 names = [], 69 elements = [], 70 overflow = [], 71 index = 0, 72 currentIndex = 0, 73 interstitialIndex = 1, 74 hasLocation = false, 75 timeoutId, 76 timeoutId2, 77 $window = $(window), 78 portHeight, 79 top = $window.scrollTop(), 80 scrollable = false, 81 locked = false, 82 scrolled = false, 83 manualScroll, 84 swipeScroll, 85 util, 86 disabled = false, 87 scrollSamples = [], 88 scrollTime = new Date().getTime(), 89 firstLoad = true, 90 initialised = false, 91 destination = 0, 92 wheelEvent = 'onwheel' in document ? 'wheel' : document.onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll', 93 settings = { 94 //section should be an identifier that is the same for each section 95 section: ".section", 96 sectionName: "section-name", 97 interstitialSection: "", 98 easing: "easeOutExpo", 99 scrollSpeed: 1100, 100 offset: 0, 101 scrollbars: true, 102 target:"html,body", 103 standardScrollElements: false, 104 setHeights: true, 105 overflowScroll:true, 106 updateHash: true, 107 touchScroll:true, 108 before:function() {}, 109 after:function() {}, 110 afterResize:function() {}, 111 afterRender:function() {} 112 }; 113 function getportHeight() { 114 return ($window.height() + settings.offset); 115 } 116 function animateScroll(index,instant,callbacks,toTop) { 117 if(currentIndex===index) { 118 callbacks = false; 119 } 120 if(disabled===true) { 121 return true; 122 } 123 if(names[index]) { 124 scrollable = false; 125 if(firstLoad===true) { 126 firstLoad = false; 127 settings.afterRender(); 128 } 129 if(callbacks) { 130 if( typeof settings.before == 'function' && settings.before(index,elements) === false ){ 131 return true; 132 } 133 } 134 interstitialIndex = 1; 135 destination = (!index) ? 0 : heights[index]; 136 if(firstLoad===false && currentIndex>index && toTop===false) { 137 //We're going backwards 138 if(overflow[index]) { 139 portHeight = getportHeight(); 140 141 interstitialIndex = parseInt(elements[index].outerHeight()/portHeight); 142 143 destination = parseInt(heights[index])+(elements[index].outerHeight()-portHeight); 144 } 145 } 146 147 148 if(settings.updateHash && settings.sectionName && !(firstLoad===true && index===0)) { 149 if(history.pushState) { 150 try { 151 history.replaceState(null, null, names[index]); 152 } catch (e) { 153 if(window.console) { 154 console.warn("Scrollify warning: Page must be hosted to manipulate the hash value."); 155 } 156 } 157 158 } else { 159 window.location.hash = names[index]; 160 } 161 } 162 163 currentIndex = index; 164 if(instant) { 165 $(settings.target).stop().scrollTop(destination); 166 if(callbacks) { 167 settings.after(index,elements); 168 } 169 } else { 170 locked = true; 171 if( $().velocity ) { 172 $(settings.target).stop().velocity('scroll', { 173 duration: settings.scrollSpeed, 174 easing: settings.easing, 175 offset: destination, 176 mobileHA: false 177 }); 178 } else { 179 $(settings.target).stop().animate({ 180 scrollTop: destination 181 }, settings.scrollSpeed,settings.easing); 182 } 183 184 if(window.location.hash.length && settings.sectionName && window.console) { 185 try { 186 if($(window.location.hash).length) { 187 console.warn("Scrollify warning: ID matches hash value - this will cause the page to anchor."); 188 } 189 } catch (e) {} 190 } 191 $(settings.target).promise().done(function(){ 192 locked = false; 193 firstLoad = false; 194 if(callbacks) { 195 settings.after(index,elements); 196 } 197 }); 198 } 199 200 } 201 } 202 203 function isAccelerating(samples) { 204 function average(num) { 205 var sum = 0; 206 207 var lastElements = samples.slice(Math.max(samples.length - num, 1)); 208 209 for(var i = 0; i < lastElements.length; i++){ 210 sum += lastElements[i]; 211 } 212 213 return Math.ceil(sum/num); 214 } 215 216 var avEnd = average(10); 217 var avMiddle = average(70); 218 219 if(avEnd >= avMiddle) { 220 return true; 221 } else { 222 return false; 223 } 224 } 225 var scrollify = function(options) { 226 initialised = true; 227 $.easing['easeOutExpo'] = function(x, t, b, c, d) { 228 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 229 }; 230 231 manualScroll = { 232 handleMousedown:function() { 233 if(disabled===true) { 234 return true; 235 } 236 scrollable = false; 237 scrolled = false; 238 }, 239 handleMouseup:function() { 240 if(disabled===true) { 241 return true; 242 } 243 scrollable = true; 244 if(scrolled) { 245 //instant,callbacks 246 manualScroll.calculateNearest(false,true); 247 } 248 }, 249 handleScroll:function() { 250 if(disabled===true) { 251 return true; 252 } 253 if(timeoutId){ 254 clearTimeout(timeoutId); 255 } 256 257 timeoutId = setTimeout(function(){ 258 scrolled = true; 259 if(scrollable===false) { 260 return false; 261 } 262 scrollable = false; 263 //instant,callbacks 264 manualScroll.calculateNearest(false,true); 265 }, 200); 266 }, 267 calculateNearest:function(instant,callbacks) { 268 top = $window.scrollTop(); 269 var i =1, 270 max = heights.length, 271 closest = 0, 272 prev = Math.abs(heights[0] - top), 273 diff; 274 for(;i<max;i++) { 275 diff = Math.abs(heights[i] - top); 276 277 if(diff < prev) { 278 prev = diff; 279 closest = i; 280 } 281 } 282 if((atBottom() && closest>index) || atTop()) { 283 index = closest; 284 //index, instant, callbacks, toTop 285 animateScroll(closest,instant,callbacks,false); 286 } 287 }, 288 wheelHandler:function(e) { 289 if(disabled===true) { 290 return true; 291 } else if(settings.standardScrollElements) { 292 if($(e.target).is(settings.standardScrollElements) || $(e.target).closest(settings.standardScrollElements).length) { 293 return true; 294 } 295 } 296 if(!overflow[index]) { 297 e.preventDefault(); 298 } 299 var currentScrollTime = new Date().getTime(); 300 301 302 e = e || window.event; 303 var value; 304 if (e.originalEvent) { 305 value = e.originalEvent.wheelDelta || -e.originalEvent.deltaY || -e.originalEvent.detail; 306 } else { 307 value = e.wheelDelta || -e.deltaY || -e.detail; 308 } 309 var delta = Math.max(-1, Math.min(1, value)); 310 311 //delta = delta || -e.originalEvent.detail / 3 || e.originalEvent.wheelDelta / 120; 312 313 if(scrollSamples.length > 149){ 314 scrollSamples.shift(); 315 } 316 //scrollSamples.push(Math.abs(delta*10)); 317 scrollSamples.push(Math.abs(value)); 318 319 if((currentScrollTime-scrollTime) > 200){ 320 scrollSamples = []; 321 } 322 scrollTime = currentScrollTime; 323 324 325 if(locked) { 326 return false; 327 } 328 if(delta<0) { 329 if(index<heights.length-1) { 330 if(atBottom()) { 331 if(isAccelerating(scrollSamples)) { 332 e.preventDefault(); 333 index++; 334 locked = true; 335 //index, instant, callbacks, toTop 336 animateScroll(index,false,true, false); 337 } else { 338 return false; 339 } 340 } 341 } 342 } else if(delta>0) { 343 if(index>0) { 344 if(atTop()) { 345 if(isAccelerating(scrollSamples)) { 346 e.preventDefault(); 347 index--; 348 locked = true; 349 //index, instant, callbacks, toTop 350 animateScroll(index,false,true, false); 351 } else { 352 return false 353 } 354 } 355 } 356 } 357 358 }, 359 keyHandler:function(e) { 360 if(disabled===true || document.activeElement.readOnly===false) { 361 return true; 362 } else if(settings.standardScrollElements) { 363 if($(e.target).is(settings.standardScrollElements) || $(e.target).closest(settings.standardScrollElements).length) { 364 return true; 365 } 366 } 367 if(locked===true) { 368 return false; 369 } 370 if(e.keyCode==38 || e.keyCode==33) { 371 if(index>0) { 372 if(atTop()) { 373 e.preventDefault(); 374 index--; 375 //index, instant, callbacks, toTop 376 animateScroll(index,false,true,false); 377 } 378 } 379 } else if(e.keyCode==40 || e.keyCode==34) { 380 if(index<heights.length-1) { 381 if(atBottom()) { 382 e.preventDefault(); 383 index++; 384 //index, instant, callbacks, toTop 385 animateScroll(index,false,true,false); 386 } 387 } 388 } 389 }, 390 init:function() { 391 if(settings.scrollbars) { 392 $window.on('mousedown', manualScroll.handleMousedown); 393 $window.on('mouseup', manualScroll.handleMouseup); 394 $window.on('scroll', manualScroll.handleScroll); 395 } else { 396 $("body").css({"overflow":"hidden"}); 397 } 398 window.addEventListener(wheelEvent, manualScroll.wheelHandler, { passive: false }); 399 //$(document).bind(wheelEvent,manualScroll.wheelHandler); 400 $window.on('keydown', manualScroll.keyHandler); 401 } 402 }; 403 404 swipeScroll = { 405 touches : { 406 "touchstart": {"y":-1,"x":-1}, 407 "touchmove" : {"y":-1,"x":-1}, 408 "touchend" : false, 409 "direction" : "undetermined" 410 }, 411 options:{ 412 "distance" : 30, 413 "timeGap" : 800, 414 "timeStamp" : new Date().getTime() 415 }, 416 touchHandler: function(event) { 417 if(disabled===true) { 418 return true; 419 } else if(settings.standardScrollElements) { 420 if($(event.target).is(settings.standardScrollElements) || $(event.target).closest(settings.standardScrollElements).length) { 421 return true; 422 } 423 } 424 var touch; 425 if (typeof event !== 'undefined'){ 426 if (typeof event.touches !== 'undefined') { 427 touch = event.touches[0]; 428 switch (event.type) { 429 case 'touchstart': 430 swipeScroll.touches.touchstart.y = touch.pageY; 431 swipeScroll.touches.touchmove.y = -1; 432 433 swipeScroll.touches.touchstart.x = touch.pageX; 434 swipeScroll.touches.touchmove.x = -1; 435 436 swipeScroll.options.timeStamp = new Date().getTime(); 437 swipeScroll.touches.touchend = false; 438 case 'touchmove': 439 swipeScroll.touches.touchmove.y = touch.pageY; 440 swipeScroll.touches.touchmove.x = touch.pageX; 441 if(swipeScroll.touches.touchstart.y!==swipeScroll.touches.touchmove.y && (Math.abs(swipeScroll.touches.touchstart.y-swipeScroll.touches.touchmove.y)>Math.abs(swipeScroll.touches.touchstart.x-swipeScroll.touches.touchmove.x))) { 442 //if(!overflow[index]) { 443 event.preventDefault(); 444 //} 445 swipeScroll.touches.direction = "y"; 446 if((swipeScroll.options.timeStamp+swipeScroll.options.timeGap)<(new Date().getTime()) && swipeScroll.touches.touchend == false) { 447 448 swipeScroll.touches.touchend = true; 449 if (swipeScroll.touches.touchstart.y > -1) { 450 451 if(Math.abs(swipeScroll.touches.touchmove.y-swipeScroll.touches.touchstart.y)>swipeScroll.options.distance) { 452 if(swipeScroll.touches.touchstart.y < swipeScroll.touches.touchmove.y) { 453 454 swipeScroll.up(); 455 456 } else { 457 swipeScroll.down(); 458 459 } 460 } 461 } 462 } 463 } 464 break; 465 case 'touchend': 466 if(swipeScroll.touches[event.type]===false) { 467 swipeScroll.touches[event.type] = true; 468 if (swipeScroll.touches.touchstart.y > -1 && swipeScroll.touches.touchmove.y > -1 && swipeScroll.touches.direction==="y") { 469 470 if(Math.abs(swipeScroll.touches.touchmove.y-swipeScroll.touches.touchstart.y)>swipeScroll.options.distance) { 471 if(swipeScroll.touches.touchstart.y < swipeScroll.touches.touchmove.y) { 472 swipeScroll.up(); 473 474 } else { 475 swipeScroll.down(); 476 477 } 478 } 479 swipeScroll.touches.touchstart.y = -1; 480 swipeScroll.touches.touchstart.x = -1; 481 swipeScroll.touches.direction = "undetermined"; 482 } 483 } 484 default: 485 break; 486 } 487 } 488 } 489 }, 490 down: function() { 491 492 if(index<heights.length) { 493 494 if(atBottom() && index<heights.length-1) { 495 496 index++; 497 //index, instant, callbacks, toTop 498 animateScroll(index,false,true,false); 499 } else { 500 portHeight = getportHeight(); 501 if(Math.floor(elements[index].height()/portHeight)>interstitialIndex) { 502 503 interstitialScroll(parseInt(heights[index])+(portHeight*interstitialIndex)); 504 interstitialIndex += 1; 505 506 } else { 507 interstitialScroll(parseInt(heights[index])+(elements[index].outerHeight()-portHeight)); 508 } 509 510 } 511 } 512 }, 513 up: function() { 514 if(index>=0) { 515 if(atTop() && index>0) { 516 517 index--; 518 //index, instant, callbacks, toTop 519 animateScroll(index,false,true,false); 520 } else { 521 522 if(interstitialIndex>2) { 523 portHeight = getportHeight(); 524 525 interstitialIndex -= 1; 526 interstitialScroll(parseInt(heights[index])+(portHeight*interstitialIndex)); 527 528 } else { 529 530 interstitialIndex = 1; 531 interstitialScroll(parseInt(heights[index])); 532 } 533 } 534 535 } 536 }, 537 init: function() { 538 if (document.addEventListener && settings.touchScroll) { 539 var eventListenerOptions = { 540 passive: false 541 }; 542 document.addEventListener('touchstart', swipeScroll.touchHandler, eventListenerOptions); 543 document.addEventListener('touchmove', swipeScroll.touchHandler, eventListenerOptions); 544 document.addEventListener('touchend', swipeScroll.touchHandler, eventListenerOptions); 545 } 546 } 547 }; 548 549 550 util = { 551 refresh:function(withCallback,scroll) { 552 clearTimeout(timeoutId2); 553 timeoutId2 = setTimeout(function() { 554 //retain position 555 sizePanels(true); 556 //scroll, firstLoad 557 calculatePositions(scroll,false); 558 if(withCallback) { 559 settings.afterResize(); 560 } 561 },400); 562 }, 563 handleUpdate:function() { 564 //callbacks, scroll 565 //changed from false,true to false,false 566 util.refresh(false,false); 567 }, 568 handleResize:function() { 569 //callbacks, scroll 570 util.refresh(true,false); 571 }, 572 handleOrientation:function() { 573 //callbacks, scroll 574 util.refresh(true,true); 575 } 576 }; 577 settings = $.extend(settings, options); 578 579 //retain position 580 sizePanels(false); 581 582 calculatePositions(false,true); 583 584 if(true===hasLocation) { 585 //index, instant, callbacks, toTop 586 animateScroll(index,false,true,true); 587 } else { 588 setTimeout(function() { 589 //instant,callbacks 590 manualScroll.calculateNearest(true,false); 591 },200); 592 } 593 if(heights.length) { 594 manualScroll.init(); 595 swipeScroll.init(); 596 597 $window.on("resize",util.handleResize); 598 if (document.addEventListener) { 599 window.addEventListener("orientationchange", util.handleOrientation, false); 600 } 601 } 602 function interstitialScroll(pos) { 603 if( $().velocity ) { 604 $(settings.target).stop().velocity('scroll', { 605 duration: settings.scrollSpeed, 606 easing: settings.easing, 607 offset: pos, 608 mobileHA: false 609 }); 610 } else { 611 $(settings.target).stop().animate({ 612 scrollTop: pos 613 }, settings.scrollSpeed,settings.easing); 614 } 615 } 616 617 function sizePanels(keepPosition) { 618 if(keepPosition) { 619 top = $window.scrollTop(); 620 } 621 622 var selector = settings.section; 623 overflow = []; 624 if(settings.interstitialSection.length) { 625 selector += "," + settings.interstitialSection; 626 } 627 if(settings.scrollbars===false) { 628 settings.overflowScroll = false; 629 } 630 portHeight = getportHeight(); 631 $(selector).each(function(i) { 632 var $this = $(this); 633 634 if(settings.setHeights) { 635 if($this.is(settings.interstitialSection)) { 636 overflow[i] = false; 637 } else { 638 if(($this.css("height","auto").outerHeight()<portHeight) || $this.css("overflow")==="hidden") { 639 $this.css({"height":portHeight}); 640 641 overflow[i] = false; 642 } else { 643 644 $this.css({"height":$this.outerHeight()}); 645 646 if(settings.overflowScroll) { 647 overflow[i] = true; 648 } else { 649 overflow[i] = false; 650 } 651 } 652 653 } 654 655 } else { 656 657 if(($this.outerHeight()<portHeight) || (settings.overflowScroll===false)) { 658 overflow[i] = false; 659 } else { 660 overflow[i] = true; 661 } 662 } 663 }); 664 if(keepPosition) { 665 $window.scrollTop(top); 666 } 667 } 668 function calculatePositions(scroll,firstLoad) { 669 var selector = settings.section; 670 if(settings.interstitialSection.length) { 671 selector += "," + settings.interstitialSection; 672 } 673 heights = []; 674 names = []; 675 elements = []; 676 $(selector).each(function(i){ 677 var $this = $(this); 678 if(i>0) { 679 heights[i] = parseInt($this.offset().top) + settings.offset; 680 } else { 681 heights[i] = parseInt($this.offset().top); 682 } 683 if(settings.sectionName && $this.data(settings.sectionName)) { 684 names[i] = "#" + $this.data(settings.sectionName).toString().replace(/ /g,"-"); 685 } else { 686 if($this.is(settings.interstitialSection)===false) { 687 names[i] = "#" + (i + 1); 688 } else { 689 names[i] = "#"; 690 if(i===$(selector).length-1 && i>1) { 691 heights[i] = heights[i-1] + (parseInt($($(selector)[i-1]).outerHeight()) - parseInt($(window).height())) + parseInt($this.outerHeight()); 692 } 693 } 694 } 695 elements[i] = $this; 696 try { 697 if($(names[i]).length && window.console) { 698 console.warn("Scrollify warning: Section names can't match IDs - this will cause the browser to anchor."); 699 } 700 } catch (e) {} 701 702 if(window.location.hash===names[i]) { 703 index = i; 704 hasLocation = true; 705 } 706 707 }); 708 709 if(true===scroll) { 710 //index, instant, callbacks, toTop 711 animateScroll(index,false,false,false); 712 } 713 } 714 715 function atTop() { 716 if(!overflow[index]) { 717 return true; 718 } 719 top = $window.scrollTop(); 720 if(top>parseInt(heights[index])) { 721 return false; 722 } else { 723 return true; 724 } 725 } 726 function atBottom() { 727 if(!overflow[index]) { 728 return true; 729 } 730 top = $window.scrollTop(); 731 portHeight = getportHeight(); 732 733 if(top<parseInt(heights[index])+(elements[index].outerHeight()-portHeight)-28) { 734 735 return false; 736 737 } else { 738 return true; 739 } 740 } 741 } 742 743 function move(panel,instant) { 744 var z = names.length; 745 for(;z>=0;z--) { 746 if(typeof panel === 'string') { 747 if (names[z]===panel) { 748 index = z; 749 //index, instant, callbacks, toTop 750 animateScroll(z,instant,true,true); 751 } 752 } else { 753 if(z===panel) { 754 index = z; 755 //index, instant, callbacks, toTop 756 animateScroll(z,instant,true,true); 757 } 758 } 759 } 760 } 761 scrollify.move = function(panel) { 762 if(panel===undefined) { 763 return false; 764 } 765 if(panel.originalEvent) { 766 panel = $(this).attr("href"); 767 } 768 move(panel,false); 769 }; 770 scrollify.instantMove = function(panel) { 771 if(panel===undefined) { 772 return false; 773 } 774 move(panel,true); 775 }; 776 scrollify.next = function() { 777 if(index<names.length) { 778 index += 1; 779 //index, instant, callbacks, toTop 780 animateScroll(index,false,true,true); 781 } 782 }; 783 scrollify.previous = function() { 784 if(index>0) { 785 index -= 1; 786 //index, instant, callbacks, toTop 787 animateScroll(index,false,true,true); 788 } 789 }; 790 scrollify.instantNext = function() { 791 if(index<names.length) { 792 index += 1; 793 //index, instant, callbacks, toTop 794 animateScroll(index,true,true,true); 795 } 796 }; 797 scrollify.instantPrevious = function() { 798 if(index>0) { 799 index -= 1; 800 //index, instant, callbacks, toTop 801 animateScroll(index,true,true,true); 802 } 803 }; 804 scrollify.destroy = function() { 805 if(!initialised) { 806 return false; 807 } 808 if(settings.setHeights) { 809 $(settings.section).each(function() { 810 $(this).css("height","auto"); 811 }); 812 } 813 $window.off("resize",util.handleResize); 814 if(settings.scrollbars) { 815 $window.off('mousedown', manualScroll.handleMousedown); 816 $window.off('mouseup', manualScroll.handleMouseup); 817 $window.off('scroll', manualScroll.handleScroll); 818 } 819 // $window.off(wheelEvent,manualScroll.wheelHandler); 820 window.removeEventListener(wheelEvent,manualScroll.wheelHandler); 821 $window.off('keydown', manualScroll.keyHandler); 822 823 if (document.addEventListener && settings.touchScroll) { 824 document.removeEventListener('touchstart', swipeScroll.touchHandler, false); 825 document.removeEventListener('touchmove', swipeScroll.touchHandler, false); 826 document.removeEventListener('touchend', swipeScroll.touchHandler, false); 827 } 828 heights = []; 829 names = []; 830 elements = []; 831 overflow = []; 832 }; 833 scrollify.update = function() { 834 if(!initialised) { 835 return false; 836 } 837 util.handleUpdate(); 838 }; 839 scrollify.current = function() { 840 return elements[index]; 841 }; 842 scrollify.currentIndex = function() { 843 return index; 844 }; 845 scrollify.disable = function() { 846 disabled = true; 847 }; 848 scrollify.enable = function() { 849 disabled = false; 850 if (initialised) { 851 //instant,callbacks 852 manualScroll.calculateNearest(false,false); 853 } 854 }; 855 scrollify.isDisabled = function() { 856 return disabled; 857 }; 858 scrollify.setOptions = function(updatedOptions) { 859 if(!initialised) { 860 return false; 861 } 862 if(typeof updatedOptions === "object") { 863 settings = $.extend(settings, updatedOptions); 864 util.handleUpdate(); 865 } else if(window.console) { 866 console.warn("Scrollify warning: setOptions expects an object."); 867 } 868 }; 869 $.scrollify = scrollify; 870 return scrollify; 871})); 872//© 2019 GitHub, Inc. 873//Terms 874//Privacy 875//Security 876//Status 877//Help 878//Contact GitHub 879//Pricing 880//API 881//Training 882//Blog 883//About
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.