1var $ = jQuery.noConflict(); 2 3/** 4 * fullPage 2.3.3 5 * https://github.com/alvarotrigo/fullPage.js 6 * MIT licensed 7 * 8 * Copyright (C) 2013 alvarotrigo.com - A project by Alvaro Trigo 9 */ 10 11(function($) { 12 $.fn.fullpage = function(options) { 13 // Create some defaults, extending them with any options that were provided 14 options = $.extend({ 15 "verticalCentered": true, 16 'resize': true, 17 'sectionsColor' : [], 18 'anchors':[], 19 'scrollingSpeed': 700, 20 'easing': 'easeInQuart', 21 'menu': false, 22 'navigation': false, 23 'navigationPosition': 'right', 24 'navigationColor': '#000', 25 'navigationTooltips': [], 26 'slidesNavigation': false, 27 'slidesNavPosition': 'bottom', 28 'controlArrowColor': '#fff', 29 'loopBottom': false, 30 'loopTop': false, 31 'loopHorizontal': true, 32 'autoScrolling': false, 33 'scrollOverflow': false, 34 'css3': false, 35 'paddingTop': 0, 36 'paddingBottom': 0, 37 'fixedElements': null, 38 'normalScrollElements': null, 39 'keyboardScrolling': true, 40 'touchSensitivity': 5, 41 'continuousVertical': false, 42 'animateAnchor': true, 43 'normalScrollElementTouchThreshold': 5, 44 'sectionSelector': '.section', 45 'slideSelector': '.slide', 46 47 //events 48 'afterLoad': null, 49 'onLeave': null, 50 'afterRender': null, 51 'afterResize': null, 52 'afterReBuild': null, 53 'afterSlideLoad': null, 54 'onSlideLeave': null 55 }, options); 56 57 // Disable mutually exclusive settings 58 if (options.continuousVertical && 59 (options.loopTop || options.loopBottom)) { 60 options.continuousVertical = false; 61 console && console.log && console.log("Option loopTop/loopBottom is mutually exclusive with continuousVertical; continuousVertical disabled"); 62 } 63 64 //Defines the delay to take place before being able to scroll to the next section 65 //BE CAREFUL! Not recommened to change it under 400 for a good behavior in laptops and 66 //Apple devices (laptops, mouses...) 67 var scrollDelay = 600; 68 69 $.fn.fullpage.setAutoScrolling = function(value){ 70 options.autoScrolling = value; 71 72 var element = $('.fp-section.active'); 73 74 if(options.autoScrolling){ 75 $('html, body').css({ 76 'overflow' : 'hidden', 77 'height' : '100%' 78 }); 79 80 //for IE touch devices 81 container.css({ 82 '-ms-touch-action': 'none', 83 'touch-action': 'none' 84 }); 85 86 if(element.length){ 87 //moving the container up 88 silentScroll(element.position().top); 89 } 90 91 }else{ 92 $('html, body').css({ 93 'overflow' : 'visible', 94 'height' : 'initial' 95 }); 96 97 //for IE touch devices 98 container.css({ 99 '-ms-touch-action': '', 100 'touch-action': '' 101 }); 102 103 silentScroll(0); 104 105 //scrolling the page to the section with no animation 106 // $('html, body').scrollTop(element.position().top); 107 } 108 109 }; 110 111 /** 112 * Defines the scrolling speed 113 */ 114 $.fn.fullpage.setScrollingSpeed = function(value){ 115 options.scrollingSpeed = value; 116 }; 117 118 /** 119 * Adds or remove the possiblity of scrolling through sections by using the mouse wheel or the trackpad. 120 */ 121 $.fn.fullpage.setMouseWheelScrolling = function (value){ 122 if(value){ 123 addMouseWheelHandler(); 124 }else{ 125 removeMouseWheelHandler(); 126 } 127 }; 128 129 /** 130 * Adds or remove the possiblity of scrolling through sections by using the mouse wheel/trackpad or touch gestures. 131 */ 132 $.fn.fullpage.setAllowScrolling = function (value){ 133 if(value){ 134 $.fn.fullpage.setMouseWheelScrolling(true); 135 addTouchHandler(); 136 }else{ 137 $.fn.fullpage.setMouseWheelScrolling(false); 138 removeTouchHandler(); 139 } 140 }; 141 142 /** 143 * Adds or remove the possiblity of scrolling through sections by using the keyboard arrow keys 144 */ 145 $.fn.fullpage.setKeyboardScrolling = function (value){ 146 options.keyboardScrolling = value; 147 }; 148 149 $.fn.fullpage.moveSectionUp = function(){ 150 var prev = $('.fp-section.active').prev('.fp-section'); 151 152 //looping to the bottom if there's no more sections above 153 if (!prev.length && (options.loopTop || options.continuousVertical)) { 154 prev = $('.fp-section').last(); 155 } 156 157 if (prev.length) { 158 scrollPage(prev, null, true); 159 } 160 }; 161 162 $.fn.fullpage.moveSectionDown = function (){ 163 var next = $('.fp-section.active').next('.fp-section'); 164 165 //looping to the top if there's no more sections below 166 if(!next.length &&
167 (options.loopBottom || options.continuousVertical)){ 168 next = $('.fp-section').first(); 169 } 170 171 if(next.length){ 172 scrollPage(next, null, false); 173 } 174 }; 175 176 $.fn.fullpage.moveTo = function (section, slide){ 177 var destiny = ''; 178 179 if(isNaN(section)){ 180 destiny = $('[data-anchor="'+section+'"]'); 181 }else{ 182 destiny = $('.fp-section').eq( (section -1) ); 183 } 184 185 if (typeof slide !== 'undefined'){ 186 scrollPageAndSlide(section, slide); 187 }else if(destiny.length > 0){ 188 scrollPage(destiny); 189 } 190 }; 191 192 $.fn.fullpage.moveSlideRight = function(){ 193 moveSlide('next'); 194 }; 195 196 $.fn.fullpage.moveSlideLeft = function(){ 197 moveSlide('prev'); 198 }; 199 200 /** 201 * When resizing is finished, we adjust the slides sizes and positions 202 */ 203 $.fn.fullpage.reBuild = function(resizing){ 204 isResizing = true; 205 206 var windowsWidth = $(window).width(); 207 windowsHeight = $(window).height(); 208 209 //text and images resizing 210 if (options.resize) { 211 resizeMe(windowsHeight, windowsWidth); 212 } 213 214 $('.fp-section').each(function(){ 215 var scrollHeight = windowsHeight - parseInt($(this).css('padding-bottom')) - parseInt($(this).css('padding-top')); 216 217 //adjusting the height of the table-cell for IE and Firefox 218 if(options.verticalCentered){ 219 $(this).find('.fp-tableCell').css('height', getTableHeight($(this)) + 'px'); 220 } 221 222 $(this).css('height', windowsHeight + 'px'); 223 224 //resizing the scrolling divs 225 if(options.scrollOverflow){ 226 var slides = $(this).find('.fp-slide'); 227 228 if(slides.length){ 229 slides.each(function(){ 230 createSlimScrolling($(this)); 231 }); 232 }else{ 233 createSlimScrolling($(this)); 234 } 235 } 236 237 //adjusting the position fo the FULL WIDTH slides... 238 var slides = $(this).find('.fp-slides'); 239 if (slides.length) { 240 landscapeScroll(slides, slides.find('.fp-slide.active')); 241 } 242 }); 243 244 //adjusting the position for the current section 245 var destinyPos = $('.fp-section.active').position(); 246 247 var activeSection = $('.fp-section.active'); 248 249 //isn't it the first section? 250 if(activeSection.index('.fp-section')){ 251 scrollPage(activeSection); 252 } 253 254 isResizing = false; 255 $.isFunction( options.afterResize ) && resizing && options.afterResize.call( this ) 256 $.isFunction( options.afterReBuild ) && !resizing && options.afterReBuild.call( this ); 257 } 258 259 //flag to avoid very fast sliding for landscape sliders 260 var slideMoving = false; 261 262 var isTouchDevice = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|BB10|Windows Phone|Tizen|Bada)/); 263 var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0)); 264 var container = $(this); 265 var windowsHeight = $(window).height(); 266 var isMoving = false; 267 var isResizing = false; 268 var lastScrolledDestiny; 269 var lastScrolledSlide; 270 var nav; 271 var wrapperSelector = 'fullpage-wrapper'; 272 273 $.fn.fullpage.setAllowScrolling(true); 274 275 //if css3 is not supported, it will use jQuery animations 276 if(options.css3){ 277 options.css3 = support3d(); 278 } 279 280 if($(this).length){ 281 container.css({ 282 'height': '100%', 283 'position': 'relative' 284 }); 285 286 //adding a class to recognize the container internally in the code 287 container.addClass(wrapperSelector); 288 } 289 290 //trying to use fullpage without a selector? 291 else{ 292 console.error("Error! Fullpage.js needs to be initialized with a selector. For example: $('#myContainer').fullpage();"); 293 } 294 295 //adding internal class names to void problem with common ones 296 $(options.sectionSelector).each(function(){ 297 $(this).addClass('fp-section'); 298 }); 299 $(options.slideSelector).each(function(){ 300 $(this).addClass('fp-slide'); 301 }); 302 303 //creating the navigation dots 304 if (options.navigation) { 305 addVerticalNavigation(); 306 } 307 308 $('.fp-section').each(function(index){ 309 var that = $(this); 310 var slides = $(this).find('.fp-slide'); 311 var numSlides = slides.length; 312 313 //if no active section is defined, the 1st one will be the default one 314 if(!index && $('.fp-section.active').length === 0) { 315 $(this).addClass('active'); 316 } 317 318 $(this).css('height', windowsHeight + 'px'); 319 320 if(options.paddingTop || options.paddingBottom){ 321 $(this).css('padding', options.paddingTop + ' 0 ' + options.paddingBottom + ' 0'); 322 } 323 324 if (typeof options.sectionsColor[index] !== 'undefined') { 325 $(this).css('background-color', options.sectionsColor[index]); 326 } 327 328 if (typeof options.anchors[index] !== 'undefined') { 329 $(this).attr('data-anchor', options.anchors[index]); 330 } 331 332 // if there's any slide 333 if (numSlides > 1) { 334 var sliderWidth = numSlides * 100; 335 var slideWidth = 100 / numSlides; 336 337 slides.wrapAll('<div class="fp-slidesContainer" />'); 338 slides.parent().wrap('<div class="fp-slides" />'); 339 340 $(this).find('.fp-slidesContainer').css('width', sliderWidth + '%'); 341 $(this).find('.fp-slides').after('<div class="fp-controlArrow fp-prev"></div><div class="fp-controlArrow fp-next"></div>'); 342 343 if(options.controlArrowColor!='#fff'){ 344 $(this).find('.fp-controlArrow.fp-next').css('border-color', 'transparent transparent transparent '+options.controlArrowColor); 345 $(this).find('.fp-controlArrow.fp-prev').css('border-color', 'transparent '+ options.controlArrowColor + ' transparent transparent'); 346 } 347 348 if(!options.loopHorizontal){ 349 $(this).find('.fp-controlArrow.fp-prev').hide(); 350 } 351 352 353 if(options.slidesNavigation){ 354 addSlidesNavigation($(this), numSlides); 355 } 356 357 slides.each(function(index) { 358 $(this).css('width', slideWidth + '%'); 359 360 if(options.verticalCentered){ 361 addTableClass($(this)); 362 } 363 }); 364 365 var startingSlide = that.find('.fp-slide.active'); 366 367 //if the slide won#t be an starting point, the default will be the first one 368 if(startingSlide.length == 0){ 369 slides.eq(0).addClass('active'); 370 } 371 372 //is there a starting point for a non-starting section? 373 else{ 374 silentLandscapeScroll(startingSlide); 375 } 376 377 }else{ 378 if(options.verticalCentered){ 379 addTableClass($(this)); 380 } 381 } 382 383 }).promise().done(function(){ 384 $.fn.fullpage.setAutoScrolling(options.autoScrolling); 385 386 //the starting point is a slide? 387 var activeSlide = $('.fp-section.active').find('.fp-slide.active'); 388 389 //the active section isn't the first one? Is not the first slide of the first section? Then we load that section/sl
389ide by default. 390 if( activeSlide.length && ($('.fp-section.active').index('.fp-section') != 0 || ($('.fp-section.active').index('.fp-section') == 0 && activeSlide.index() != 0))){ 391 silentLandscapeScroll(activeSlide); 392 } 393 394 //fixed elements need to be moved out of the plugin container due to problems with CSS3. 395 if(options.fixedElements && options.css3){ 396 $(options.fixedElements).appendTo('body'); 397 } 398 399 //vertical centered of the navigation + first bullet active 400 if(options.navigation){ 401 nav.css('margin-top', '-' + (nav.height()/2) + 'px'); 402 //igor active 403 //nav.find('li').eq($('.fp-section.active').index('.fp-section')).find('a').addClass('active'); 404 } 405 406 //moving the menu outside the main container if it is inside (avoid problems with fixed positions when using CSS3 tranforms) 407 if(options.menu && options.css3 && $(options.menu).closest('.fullpage-wrapper').length){ 408 $(options.menu).appendTo('body'); 409 } 410 411 if(options.scrollOverflow){ 412 if(document.readyState === "complete"){ 413 createSlimScrollingHandler(); 414 } 415 //after DOM and images are loaded 416 $(window).on('load', createSlimScrollingHandler); 417 }else{ 418 $.isFunction( options.afterRender ) && options.afterRender.call( this); 419 } 420 421 422 //getting the anchor link in the URL and deleting the `#` 423 var value = window.location.hash.replace('#', '').split('/'); 424 var destiny = value[0]; 425 426 if(destiny.length){ 427 var section = $('[data-anchor="'+destiny+'"]'); 428 429 if(!options.animateAnchor && section.length){ 430 431 if(options.autoScrolling){ 432 silentScroll(section.position().top); 433 } 434 else{ 435 silentScroll(0); 436 437 //scrolling the page to the section with no animation 438 $('html, body').scrollTop(section.position().top); 439 } 440 441 activateMenuElement(destiny); 442 activateNavDots(destiny, null); 443 444 $.isFunction( options.afterLoad ) && options.afterLoad.call( this, destiny, (section.index('.fp-section') + 1)); 445 446 //updating the active class 447 section.addClass('active').siblings().removeClass('active'); 448 } 449 } 450 451 452 $(window).on('load', function() { 453 scrollToAnchor(); 454 }); 455 456 }); 457 458 459 /** 460 * Creates a vertical navigation bar. 461 */ 462 function addVerticalNavigation(){ 463 $('body').append('<div id="fp-nav"><ul></ul></div>'); 464 nav = $('#fp-nav'); 465 466 nav.css('color', options.navigationColor); 467 nav.addClass(options.navigationPosition); 468 469 for(var cont = 0; cont < $('.fp-section').length; cont++){ 470 var link = ''; 471 if(options.anchors.length){ 472 link = options.anchors[cont]; 473 } 474 var tooltip = options.navigationTooltips[cont]; 475 if(typeof tooltip === 'undefined'){ 476 tooltip = ''; 477 } 478 479 nav.find('ul').append('<li data-tooltip="' + tooltip + '"><a href="#' + link + '"><span></span></a></li>'); 480 } 481 } 482 483 function createSlimScrollingHandler(){ 484 $('.fp-section').each(function(){ 485 var slides = $(this).find('.fp-slide'); 486 487 if(slides.length){ 488 slides.each(function(){ 489 createSlimScrolling($(this)); 490 }); 491 }else{ 492 createSlimScrolling($(this)); 493 } 494 495 }); 496 $.isFunction( options.afterRender ) && options.afterRender.call( this); 497 } 498 499 500 var scrollId; 501 var isScrolling = false; 502 503 //when scrolling... 504 $(window).on('scroll', scrollHandler); 505 506 function scrollHandler(){ 507 if(!options.autoScrolling){ 508 var currentScroll = $(window).scrollTop(); 509 510 var scrolledSections = $('.fp-section').map(function(){ 511 if ($(this).offset().top < (currentScroll + 100)){ 512 return $(this); 513 } 514 }); 515 516 //geting the last one, the current one on the screen 517 var currentSection = scrolledSections[scrolledSections.length-1]; 518 519 //executing only once the first time we reach the section 520 if(currentSection && !currentSection.hasClass('active')){ 521 isScrolling = true; 522 523 var leavingSection = $('.fp-section.active').index('.fp-section') + 1; 524 var yMovement = getYmovement(currentSection); 525 var anchorLink = currentSection.data('anchor'); 526 527 currentSection.addClass('active').siblings().removeClass('active'); 528 529 $.isFunction( options.onLeave ) && options.onLeave.call( this, leavingSection, (currentSection.index('.fp-section') + 1), yMovement); 530 531 $.isFunction( options.afterLoad ) && options.afterLoad.call( this, anchorLink, (currentSection.index('.fp-section') + 1)); 532 533 activateMenuElement(anchorLink); 534 activateNavDots(anchorLink, 0); 535 536 if(options.anchors.length && !isMoving){ 537 //needed to enter in hashChange event when using the menu with anchor links 538 lastScrolledDestiny = anchorLink; 539 540 location.hash = anchorLink; 541 } 542 543 //small timeout in order to avoid entering in hashChange event when scrolling is not finished yet 544 clearTimeout(scrollId); 545 scrollId = setTimeout(function(){ 546 isScrolling = false; 547 }, 200); 548 } 549 } 550 } 551 552 553 /** 554 * Determines whether the active section or slide is scrollable through and scrolling bar 555 */ 556 function isScrollable(activeSection){ 557 //if there are landscape slides, we check if the scrolling bar is in the current one or not 558 if(activeSection.find('.fp-slides').length){ 559 scrollable= activeSection.find('.fp-slide.active').find('.fp-scrollable'); 560 }else{ 561 scrollable = activeSection.find('.fp-scrollable'); 562 } 563 564 return scrollable; 565 } 566 567 /** 568 * Determines the way of scrolling up or down: 569 * by 'automatically' scrolling a section or by using the default and n
569ormal scrolling. 570 */ 571 function scrolling(type, scrollable){ 572 if(type == 'down'){ 573 var check = 'bottom'; 574 var scrollSection = $.fn.fullpage.moveSectionDown; 575 }else{ 576 var check = 'top'; 577 var scrollSection = $.fn.fullpage.moveSectionUp; 578 } 579 580 if(scrollable.length > 0 ){ 581 //is the scrollbar at the start/end of the scroll? 582 if(isScrolled(check, scrollable)){ 583 scrollSection(); 584 }else{ 585 return true; 586 } 587 }else{ 588 // moved up/down 589 scrollSection(); 590 } 591 } 592 593 594 var touchStartY = 0; 595 var touchStartX = 0; 596 var touchEndY = 0; 597 var touchEndX = 0; 598 599 /* Detecting touch events 600 601 * As we are changing the top property of the page on scrolling, we can not use the traditional way to detect it. 602 * This way, the touchstart and the touch moves shows an small difference between them which is the 603 * used one to determine the direction. 604 */ 605 function touchMoveHandler(event){ 606 var e = event.originalEvent; 607 608 // additional: if one of the normalScrollElements isn't within options.normalScrollElementTouchThreshold hops up the DOM chain 609 if (!checkParentForNormalScrollElement(event.target)) { 610 611 if(options.autoScrolling){ 612 //preventing the easing on iOS devices 613 event.preventDefault(); 614 } 615 616 var activeSection = $('.fp-section.active'); 617 var scrollable = isScrollable(activeSection); 618 619 if (!isMoving && !slideMoving) { //if theres any # 620 var touchEvents = getEventsPage(e); 621 touchEndY = touchEvents['y']; 622 touchEndX = touchEvents['x']; 623 624 //if movement in the X axys is greater than in the Y and the currect section has slides... 625 if (activeSection.find('.fp-slides').length && Math.abs(touchStartX - touchEndX) > (Math.abs(touchStartY - touchEndY))) { 626 627 //is the movement greater than the minimum resistance to scroll? 628 if (Math.abs(touchStartX - touchEndX) > ($(window).width() / 100 * options.touchSensitivity)) { 629 if (touchStartX > touchEndX) { 630 $.fn.fullpage.moveSlideRight(); //next 631 } else { 632 $.fn.fullpage.moveSlideLeft(); //prev 633 } 634 } 635 } 636 637 //vertical scrolling (only when autoScrolling is enabled) 638 else if(options.autoScrolling){ 639 640 //is the movement greater than the minimum resistance to scroll? 641 if (Math.abs(touchStartY - touchEndY) > ($(window).height() / 100 * options.touchSensitivity)) { 642 if (touchStartY > touchEndY) { 643 scrolling('down', scrollable); 644 } else if (touchEndY > touchStartY) { 645 scrolling('up', scrollable); 646 } 647 } 648 } 649 } 650 } 651 652 } 653 654 /** 655 * recursive function to loop up the parent nodes to check if one of them exists in options.normalScrollElements 656 * Currently works well for iOS - Android might need some testing 657 * @param {Element} el target element / jquery selector (in subsequent nodes) 658 * @param {int} hop current hop compared to options.normalScrollElementTouchThreshold 659 * @return {boolean} true if there is a match to options.normalScrollElements 660 */ 661 function checkParentForNormalScrollElement (el, hop) { 662 hop = hop || 0; 663 var parent = $(el).parent(); 664 665 if (hop < options.normalScrollElementTouchThreshold && 666 parent.is(options.normalScrollElements) ) { 667 return true; 668 } else if (hop == options.normalScrollElementTouchThreshold) { 669 return false; 670 } else { 671 return checkParentForNormalScrollElement(parent, ++hop); 672 } 673 } 674 675 function touchStartHandler(event){ 676 var e = event.originalEvent; 677 var touchEvents = getEventsPage(e); 678 touchStartY = touchEvents['y']; 679 touchStartX = touchEvents['x']; 680 } 681 682 683 /** 684 * Detecting mousewheel scrolling 685 * 686 * http://blogs.sitepointstatic.com/examples/tech/mouse-wheel/index.html 687 * http://www.sitepoint.com/html5-javascript-mouse-wheel/ 688 */ 689 function MouseWheelHandler(e) { 690 if(options.autoScrolling){ 691 // cross-browser wheel delta 692 e = window.event || e; 693 var delta = Math.max(-1, Math.min(1, 694 (e.wheelDelta || -e.deltaY || -e.detail))); 695 696 var activeSection = $('.fp-section.active'); 697 var scrollable = isScrollable(activeSection); 698 699 if (!isMoving) { //if theres any # 700 //scrolling down? 701 if (delta < 0) { 702 scrolling('down', scrollable); 703 704 //scrolling up? 705 }else { 706 scrolling('up', scrollable); 707 } 708 } 709 710 return false; 711 } 712 } 713 714 function moveSlide(direction){ 715 var activeSection = $('.fp-section.active'); 716 var slides = activeSection.find('.fp-slides'); 717 718 // more than one slide needed and nothing should be sliding 719 if (!slides.length || slideMoving) { 720 return; 721 } 722 723 var currentSlide = slides.find('.fp-slide.active'); 724 var destiny = null; 725 726 if(direction === 'prev'){ 727 destiny = currentSlide.prev('.fp-slide'); 728 }else{ 729 destiny = currentSlide.next('.fp-slide'); 730 } 731 732 //isn't there a next slide in the secuence? 733 if(!destiny.length){ 734 //respect loopHorizontal settin 735 if (!options.loopHorizontal) return; 736 737 if(direction === 'prev'){ 738 destiny = currentSlide.siblings(':last'); 739 }else{ 740 destiny = currentSlide.siblings(':first'); 741 } 742 } 743 744 slideMoving = true; 745
746 landscapeScroll(slides, destiny); 747 } 748 749 /** 750 * Maintains the active slides in the viewport 751 * (Because he `scroll` animation might get lost with some actions, such as when using continuousVertical) 752 */ 753 function keepSlidesPosition(){ 754 $('.fp-slide.active').each(function(){ 755 silentLandscapeScroll($(this)); 756 }); 757 } 758 759 function scrollPage(element, callback, isMovementUp){ 760 var scrollOptions = {}, scrolledElement; 761 var dest = element.position(); 762 if(typeof dest === "undefined"){ return; } //there's no element to scroll, leaving the function 763 var dtop = dest.top; 764 var yMovement = getYmovement(element); 765 var anchorLink = element.data('anchor'); 766 var sectionIndex = element.index('.fp-section'); 767 var activeSlide = element.find('.fp-slide.active'); 768 var activeSection = $('.fp-section.active'); 769 var leavingSection = activeSection.index('.fp-section') + 1; 770 771 //caching the value of isResizing at the momment the function is called 772 //because it will be checked later inside a setTimeout and the value might change 773 var localIsResizing = isResizing; 774 775 if(activeSlide.length){ 776 var slideAnchorLink = activeSlide.data('anchor'); 777 var slideIndex = activeSlide.index(); 778 } 779 780 // If continuousVertical && we need to wrap around 781 if (options.autoScrolling && options.continuousVertical && typeof (isMovementUp) !== "undefined" && 782 ((!isMovementUp && yMovement == 'up') || // Intending to scroll down but about to go up or 783 (isMovementUp && yMovement == 'down'))) { // intending to scroll up but about to go down 784 785 // Scrolling down 786 if (!isMovementUp) { 787 // Move all previous sections to after the active section 788 $(".fp-section.active").after(activeSection.prevAll(".fp-section").get().reverse()); 789 } 790 else { // Scrolling up 791 // Move all next sections to before the active section 792 $(".fp-section.active").before(activeSection.nextAll(".fp-section")); 793 } 794 795 // Maintain the displayed position (now that we changed the element order) 796 silentScroll($('.fp-section.active').position().top); 797 798 // Maintain the active slides visible in the viewport 799 keepSlidesPosition(); 800 801 // save for later the elements that still need to be reordered 802 var wrapAroundElements = activeSection; 803 804 // Recalculate animation variables 805 dest = element.position(); 806 dtop = dest.top; 807 yMovement = getYmovement(element); 808 } 809 810 811 element.addClass('active').siblings().removeClass('active'); 812 813 //preventing from activating the MouseWheelHandler event 814 //more than once if the page is scrolling 815 isMoving = true; 816 817 if(typeof anchorLink !== 'undefined'){ 818 setURLHash(slideIndex, slideAnchorLink, anchorLink); 819 } 820 821 if(options.autoScrolling){ 822 scrollOptions['top'] = -dtop; 823 scrolledElement = '.'+wrapperSelector; 824 }else{ 825 scrollOptions['scrollTop'] = dtop; 826 scrolledElement = 'html, body'; 827 } 828 829 // Fix section order after continuousVertical changes have been animated 830 var continuousVerticalFixSectionOrder = function () { 831 // If continuousVertical is in effect (and autoScrolling would also be in effect then), 832 // finish moving the elements around so the direct navigation will function more simply 833 if (!wrapAroundElements || !wrapAroundElements.length) { 834 return; 835 } 836 837 if (isMovementUp) { 838 $('.fp-section:first').before(wrapAroundElements); 839 } 840 else { 841 $('.fp-section:last').after(wrapAroundElements); 842 } 843 844 silentScroll($('.fp-section.active').position().top); 845 846 // Maintain the active slides visible in the viewport 847 keepSlidesPosition(); 848 }; 849 850 851 //actions to do once the section is loaded 852 var afterSectionLoads = function(){ 853 continuousVerticalFixSectionOrder(); 854 855 //callback (afterLoad) if the site is not just resizing and readjusting the slides 856 $.isFunction(options.afterLoad) && !localIsResizing && options.afterLoad.call(this, anchorLink, (sectionIndex + 1)); 857 858 setTimeout(function () { 859 isMoving = false; 860 $.isFunction(callback) && callback.call(this); 861 }, scrollDelay); 862 } 863 864 //callback (onLeave) if the site is not just resizing and readjusting the slides 865 $.isFunction(options.onLeave) && !localIsResizing && options.onLeave.call(this, leavingSection, (sectionIndex + 1), yMovement); 866 867 // Use CSS3 translate functionality or... 868 if (options.css3 && options.autoScrolling) { 869 870 var translate3d = 'translate3d(0px, -' + dtop + 'px, 0px)'; 871 transformContainer(translate3d, true); 872 873 setTimeout(function () { 874 afterSectionLoads(); 875 }, options.scrollingSpeed); 876 } else { // ... use jQuery animate 877 878 $(scrolledElement).animate( 879 scrollOptions 880 , options.scrollingSpeed, options.easing, function () { 881 afterSectionLoads(); 882 }); 883 } 884 885 //flag to avoid callingn `scrollPage()` twice in case of using anchor links 886 lastScrolledDestiny = anchorLink; 887 888 //avoid firing it twice (as it does also on scroll) 889 if(options.autoScrolling){ 890 activateMenuElement(anchorLink); 891 activateNavDots(anchorLink, sectionIndex); 892 } 893 } 894 895 896 897 function scrollToAnchor(){
898 //getting the anchor link in the URL and deleting the `#` 899 var value = window.location.hash.replace('#', '').split('/'); 900 var section = value[0]; 901 var slide = value[1]; 902 903 if(section){ //if theres any # 904 scrollPageAndSlide(section, slide); 905 } 906 } 907 908 //detecting any change on the URL to scroll to the given anchor link 909 //(a way to detect back history button as we play with the hashes on the URL) 910 $(window).on('hashchange', hashChangeHandler); 911 912 function hashChangeHandler(){ 913 if(!isScrolling){ 914 var value = window.location.hash.replace('#', '').split('/'); 915 var section = value[0]; 916 var slide = value[1]; 917 918 if(section.length){ 919 //when moving to a slide in the first section for the first time (first time to add an anchor to the URL) 920 var isFirstSlideMove = (typeof lastScrolledDestiny === 'undefined'); 921 var isFirstScrollMove = (typeof lastScrolledDestiny === 'undefined' && typeof slide === 'undefined' && !slideMoving); 922 923 /*in order to call scrollpage() only once for each destination at a time 924 It is called twice for each scroll otherwise, as in case of using anchorlinks `hashChange` 925 event is fired on every scroll too.*/ 926 if ((section && section !== lastScrolledDestiny) && !isFirstSlideMove || isFirstScrollMove || (!slideMoving && lastScrolledSlide != slide )) { 927 scrollPageAndSlide(section, slide); 928 } 929 } 930 } 931 } 932 933 934 /** 935 * Sliding with arrow keys, both, vertical and horizontal 936 */ 937 $(document).keydown(function(e) { 938 //Moving the main page with the keyboard arrows if keyboard scrolling is enabled 939 if (options.keyboardScrolling && !isMoving) { 940 switch (e.which) { 941 //up 942 case 38: 943 case 33: 944 $.fn.fullpage.moveSectionUp(); 945 break; 946 947 //down 948 case 40: 949 case 34: 950 $.fn.fullpage.moveSectionDown(); 951 break; 952 953 //Home 954 case 36: 955 $.fn.fullpage.moveTo(1); 956 break; 957 958 //End 959 case 35: 960 $.fn.fullpage.moveTo( $('.fp-section').length ); 961 break; 962 963 //left 964 case 37: 965 $.fn.fullpage.moveSlideLeft(); 966 break; 967 968 //right 969 case 39: 970 $.fn.fullpage.moveSlideRight(); 971 break; 972 973 default: 974 return; // exit this handler for other keys 975 } 976 } 977 }); 978 979 /** 980 * Scrolls to the section when clicking the navigation bullet 981 */ 982 $(document).on('click touchstart', '#fp-nav a', function(e){ 983 e.preventDefault(); 984 var index = $(this).parent().index(); 985 scrollPage($('.fp-section').eq(index)); 986 }); 987 988 /** 989 * Scrolls the slider to the given slide destination for the given section 990 */ 991 $(document).on('click touchstart', '.fp-slidesNav a', function(e){ 992 e.preventDefault(); 993 var slides = $(this).closest('.fp-section').find('.fp-slides'); 994 var destiny = slides.find('.fp-slide').eq($(this).closest('li').index()); 995 996 landscapeScroll(slides, destiny); 997 }); 998 999 1000 //navigation tooltips 1001 $(document).on({ 1002 mouseenter: function(){ 1003 var tooltip = $(this).data('tooltip'); 1004 $('<div class="fp-tooltip ' + options.navigationPosition +'">' + tooltip + '</div>').hide().appendTo($(this)).fadeIn(200); 1005 }, 1006 mouseleave: function(){ 1007 $(this).find('.fp-tooltip').fadeOut(200, function() { 1008 $(this).remove(); 1009 }); 1010 } 1011 }, '#fp-nav li'); 1012 1013 1014 if(options.normalScrollElements){ 1015 $(document).on('mouseenter', options.normalScrollElements, function () { 1016 $.fn.fullpage.setMouseWheelScrolling(false); 1017 }); 1018 1019 $(document).on('mouseleave', options.normalScrollElements, function(){ 1020 $.fn.fullpage.setMouseWheelScrolling(true); 1021 }); 1022 } 1023 1024 /** 1025 * Scrolling horizontally when clicking on the slider controls. 1026 */ 1027 $('.fp-section').on('click touchstart', '.fp-controlArrow', function() { 1028 if ($(this).hasClass('fp-prev')) { 1029 $.fn.fullpage.moveSlideLeft(); 1030 } else { 1031 $.fn.fullpage.moveSlideRight(); 1032 } 1033 }); 1034 1035 /** 1036 * Scrolls horizontal sliders. 1037 */ 1038 function landscapeScroll(slides, destiny){ 1039 var destinyPos = destiny.position(); 1040 var slidesContainer = slides.find('.fp-slidesContainer').parent(); 1041 var slideIndex = destiny.index(); 1042 var section = slides.closest('.fp-section'); 1043 var sectionIndex = section.index('.fp-section'); 1044 var anchorLink = section.data('anchor'); 1045 var slidesNav = section.find('.fp-slidesNav'); 1046 var slideAnchor = destiny.data('anchor'); 1047 1048 //caching the value of isResizing at the momment the function is called 1049 //because it will be checked later inside a setTimeout and the value might change 1050 var localIsResizing = isResizing; 1051 1052 if(options.onSlideLeave){ 1053 var prevSlideIndex = section.find('.fp-slide.active').index(); 1054 var xMovement = getXmovement(prevSlideIndex, slideIndex); 1055 1056 //if the site is not just resizing and readjusting the slides 1057 if(!localIsResizing){ 1058 $.isFunction( options.onSlideLeave ) && options.onSlideLeave.call( this, anchorLink, (sectionIndex + 1), prevSlideIndex, xMovement); 1059 } 1060 } 1061 1062 destiny.addClass('active').siblings().removeClass('active'); 1063 1064 1065 if(typeof slideAnchor === 'undefined'){ 1066 slideAnchor = slideIndex; 1067 } 1068 1069 if(!options.loopHorizontal){ 1070 //hidding it for the fist slide, showing for the rest 1071 section.find('.fp-controlArrow.fp-prev').toggle(slideIndex!=0); 1072 1073 //hidding it for the last slide, showing for the rest 1074 section.find('.fp-controlArrow.fp-next').toggle(!destiny.is(':last-child')); 1075 } 1076 1077 //only changing the URL if the slides are in the current section (not for resize re-adjusting) 1078 if(section.hasClass('active')){ 1079 setURLHash(slideIndex, slideAnchor, anchorLink); 1080 } 1081 1082 var afterSlideLoads = function(){ 1083 //if the site is not just resizing and readjusting the slides 1084 if(!localIsResizing){ 1085 $.isFunction( options.afterSlideLoad ) && options.afterSlideLoad.call( this, anchorLink, (sectionIndex + 1), slideAnchor, slideIndex); 1086 } 1087 //letting them slide again 1088 slideMoving = false; 1089 }; 1090 1091 if(options.css3){ 1092 var translate3d = 'translate3d(-' + destinyPos.left + 'px, 0px, 0px)'; 1093 1094 slides.find('.fp-slidesContainer').toggleClass('fp-easing', options.scrollingSpeed>0).css(getTransforms(translate3d)); 1095 1096 setTimeout(function(){ 1097 afterSlideLoads(); 1098 }, options.scrollingSpeed, options.easing); 1099 }else{ 1100 slidesContainer.animate({ 1101 scrollLeft : destinyPos.left 1102 }, options.scrollingSpeed, options.easing, function() { 1103 1104 afterSlideLoads(); 1105 }); 1106 } 1107 1108 slidesNav.find('.active').removeClass('active'); 1109 slidesNav.find('li').eq(slideIndex).find('a').addClass('active'); 1110 } 1111 1112 //when resizing the site, we adjust the heights of the sections, slimScroll... 1113 $(window).resize(resizeHandler); 1114 1115 var resizeId; 1116 function resizeHandler(){ 1117 // rebuild immediately on touch devices 1118 if (isTouchDevice) { 1119 1120 //if the keyboard is visible 1121 if ($(document.activeElement).attr('type') !== 'text') { 1122 $.fn.fullpage.reBuild(true); 1123 } 1124 }else{ 1125 //in order to call the functions only when the resize is finished 1126 //http://stackoverflow.com/questions/4298612/jquery-how-to-call-resize-event-only-once-its-finished-resizing 1127 clearTimeout(resizeId); 1128 1129 resizeId = setTimeout($.fn.fullpage.reBuild(true), 500); 1130 } 1131 } 1132 1133 /** 1134 * Resizing of the font size depending on the window size as well as some of the images on the site. 1135 */ 1136 function resizeMe(displayHeight, displayWidth) { 1137 //Standard dimensions, for which the body font size is correct 1138 var preferredHeight = 825; 1139 var preferredWidth = 900; 1140 1141 if (displayHeight < preferredHeight || displayWidth < preferredWidth) { 1142 var heightPercentage = (displayHeight * 100) / preferredHeight; 1143 var widthPercentage = (displayWidth * 100) / preferredWidth; 1144 var percentage = Math.min(heightPercentage, widthPercentage); 1145 var newFontSize = percentage.toFixed(2); 1146 1147 $("body").css("font-size", newFontSize + '%'); 1148 } else { 1149 $("body").css("font-size", '100%'); 1150 } 1151 } 1152 1153 /** 1154 * Activating the website navigation dots according to the given slide name. 1155 */ 1156 function activateNavDots(name, sectionIndex){ 1157 if(options.navigation){ 1158 $('#fp-nav').find('.active').removeClass('active'); 1159 if(name){
1160 $('#fp-nav').find('a[href="#' + name + '"]').addClass('active'); 1161 }else{ 1162 $('#fp-nav').find('li').eq(sectionIndex).find('a').addClass('active'); 1163 } 1164 } 1165 } 1166 1167 /** 1168 * Activating the website main menu elements according to the given slide name. 1169 */ 1170 function activateMenuElement(name){ 1171 if(options.menu){ 1172 $(options.menu).find('.active').removeClass('active'); 1173 $(options.menu).find('[data-menuanchor="'+name+'"]').addClass('active'); 1174 } 1175 } 1176 1177 /** 1178 * Return a boolean depending on whether the scrollable element is at the end or at the start of the scrolling 1179 * depending on the given type. 1180 */ 1181 function isScrolled(type, scrollable){ 1182 if(type === 'top'){ 1183 return !scrollable.scrollTop(); 1184 }else if(type === 'bottom'){ 1185 return scrollable.scrollTop() + 1 + scrollable.innerHeight() >= scrollable[0].scrollHeight; 1186 } 1187 } 1188 1189 /** 1190 * Retuns `up` or `down` depending on the scrolling movement to reach its destination 1191 * from the current section. 1192 */ 1193 function getYmovement(destiny){ 1194 var fromIndex = $('.fp-section.active').index('.fp-section'); 1195 var toIndex = destiny.index('.fp-section'); 1196 1197 if(fromIndex > toIndex){ 1198 return 'up'; 1199 } 1200 return 'down'; 1201 } 1202 1203 /** 1204 * Retuns `right` or `left` depending on the scrolling movement to reach its destination 1205 * from the current slide. 1206 */ 1207 function getXmovement(fromIndex, toIndex){ 1208 if( fromIndex == toIndex){ 1209 return 'none' 1210 } 1211 if(fromIndex > toIndex){ 1212 return 'left'; 1213 } 1214 return 'right'; 1215 } 1216 1217 1218 function createSlimScrolling(element){ 1219 //needed to make `scrollHeight` work under Opera 12 1220 element.css('overflow', 'hidden'); 1221 1222 //in case element is a slide 1223 var section = element.closest('.fp-section'); 1224 var scrollable = element.find('.fp-scrollable'); 1225 1226 //if there was scroll, the contentHeight will be the one in the scrollable section 1227 if(scrollable.length){ 1228 var contentHeight = scrollable.get(0).scrollHeight; 1229 }else{ 1230 var contentHeight = element.get(0).scrollHeight; 1231 if(options.verticalCentered){ 1232 console.log(element.attr("class")); 1233 contentHeight = element.find('.fp-tableCell').get(0).scrollHeight; 1234 } 1235 } 1236 1237 var scrollHeight = windowsHeight - parseInt(section.css('padding-bottom')) - parseInt(section.css('padding-top')); 1238 1239 //needs scroll? 1240 if ( contentHeight > scrollHeight) { 1241 //was there already an scroll ? Updating it 1242 if(scrollable.length){ 1243 scrollable.css('height', scrollHeight + 'px').parent().css('height', scrollHeight + 'px'); 1244 } 1245 //creating the scrolling 1246 else{ 1247 if(options.verticalCentered){ 1248 element.find('.fp-tableCell').wrapInner('<div class="fp-scrollable" />'); 1249 }else{ 1250 element.wrapInner('<div class="fp-scrollable" />'); 1251 } 1252 1253 element.find('.fp-scrollable').slimScroll({ 1254 allowPageScroll: true, 1255 height: scrollHeight + 'px', 1256 size: '10px', 1257 alwaysVisible: true 1258 }); 1259 } 1260 } 1261 1262 //removing the scrolling when it is not necessary anymore 1263 else{ 1264 removeSlimScroll(element); 1265 } 1266 1267 //undo 1268 element.css('overflow', ''); 1269 } 1270 1271 function removeSlimScroll(element){ 1272 element.find('.fp-scrollable').children().first().unwrap().unwrap(); 1273 element.find('.slimScrollBar').remove(); 1274 element.find('.slimScrollRail').remove(); 1275 } 1276 1277 function addTableClass(element){ 1278 element.addClass('fp-table').wrapInner('<div class="fp-tableCell" style="height:' + getTableHeight(element) + 'px;" />'); 1279 } 1280 1281 function getTableHeight(element){ 1282 var sectionHeight = windowsHeight; 1283 1284 if(options.paddingTop || options.paddingBottom){ 1285 var section = element; 1286 if(!section.hasClass('fp-section')){ 1287 section = element.closest('.fp-section'); 1288 } 1289 1290 var paddings = parseInt(section.css('padding-top')) + parseInt(section.css('padding-bottom')); 1291 sectionHeight = (windowsHeight - paddings); 1292 } 1293 1294 return sectionHeight; 1295 } 1296 1297 /** 1298 * Adds a css3 transform property to the container class with or without animation depending on the animated param. 1299 */ 1300 function transformContainer(translate3d, animated){
1301 container.toggleClass('fp-easing', animated); 1302 1303 container.css(getTransforms(translate3d)); 1304 } 1305 1306 1307 /** 1308 * Scrolls to the given section and slide 1309 */ 1310 function scrollPageAndSlide(destiny, slide){ 1311 if (typeof slide === 'undefined') { 1312 slide = 0; 1313 } 1314 1315 if(isNaN(destiny)){ 1316 var section = $('[data-anchor="'+destiny+'"]'); 1317 }else{ 1318 var section = $('.fp-section').eq( (destiny -1) ); 1319 } 1320 1321 1322 //we need to scroll to the section and then to the slide 1323 if (destiny !== lastScrolledDestiny && !section.hasClass('active')){ 1324 scrollPage(section, function(){ 1325 scrollSlider(section, slide) 1326 }); 1327 } 1328 //if we were already in the section 1329 else{ 1330 scrollSlider(section, slide); 1331 } 1332 } 1333 1334 /** 1335 * Scrolls the slider to the given slide destination for the given section 1336 */ 1337 function scrollSlider(section, slide){ 1338 if(typeof slide != 'undefined'){ 1339 var slides = section.find('.fp-slides'); 1340 var destiny = slides.find('[data-anchor="'+slide+'"]'); 1341 1342 if(!destiny.length){ 1343 destiny = slides.find('.fp-slide').eq(slide); 1344 } 1345 1346 if(destiny.length){ 1347 landscapeScroll(slides, destiny); 1348 } 1349 } 1350 } 1351 1352 /** 1353 * Creates a landscape navigation bar with dots for horizontal sliders. 1354 */ 1355 function addSlidesNavigation(section, numSlides){ 1356 section.append('<div class="fp-slidesNav"><ul></ul></div>'); 1357 var nav = section.find('.fp-slidesNav'); 1358 1359 //top or bottom 1360 nav.addClass(options.slidesNavPosition); 1361 1362 for(var i=0; i< numSlides; i++){ 1363 nav.find('ul').append('<li><a href="#"><span></span></a></li>'); 1364 } 1365 1366 //centering it 1367 nav.css('margin-left', '-' + (nav.width()/2) + 'px'); 1368 1369 nav.find('li').first().find('a').addClass('active'); 1370 } 1371 1372 1373 /** 1374 * Sets the URL hash for a section with slides 1375 */ 1376 function setURLHash(slideIndex, slideAnchor, anchorLink){ 1377 var sectionHash = ''; 1378 1379 if(options.anchors.length){ 1380 1381 //isn't it the first slide? 1382 if(slideIndex){ 1383 if(typeof anchorLink !== 'undefined'){ 1384 sectionHash = anchorLink; 1385 } 1386 1387 //slide without anchor link? We take the index instead. 1388 if(typeof slideAnchor === 'undefined'){ 1389 slideAnchor = slideIndex; 1390 } 1391 1392 lastScrolledSlide = slideAnchor; 1393 location.hash = sectionHash + '/' + slideAnchor; 1394 1395 //first slide won't have slide anchor, just the section one 1396 }else if(typeof slideIndex !== 'undefined'){ 1397 lastScrolledSlide = slideAnchor; 1398 location.hash = anchorLink; 1399 } 1400 1401 //section without slides 1402 else{ 1403 location.hash = anchorLink; 1404 } 1405 } 1406 } 1407 1408 /** 1409 * Checks for translate3d support 1410 * @return boolean 1411 * http://stackoverflow.com/questions/5661671/detecting-transform-translate3d-support 1412 */ 1413 function support3d() { 1414 var el = document.createElement('p'), 1415 has3d, 1416 transforms = { 1417 'webkitTransform':'-webkit-transform',
1418 'OTransform':'-o-transform', 1419 'msTransform':'-ms-transform', 1420 'MozTransform':'-moz-transform', 1421 'transform':'transform' 1422 }; 1423 1424 // Add it to the body to get the computed style. 1425 document.body.insertBefore(el, null); 1426 1427 for (var t in transforms) { 1428 if (el.style[t] !== undefined) { 1429 el.style[t] = "translate3d(1px,1px,1px)"; 1430 has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]); 1431 } 1432 } 1433 1434 document.body.removeChild(el); 1435 1436 return (has3d !== undefined && has3d.length > 0 && has3d !== "none"); 1437 } 1438 1439 1440 1441 /** 1442 * Removes the auto scrolling action fired by the mouse wheel and tackpad. 1443 * After this function is called, the mousewheel and trackpad movements won't scroll through sections. 1444 */ 1445 function removeMouseWheelHandler(){ 1446 if (document.addEventListener) { 1447 document.removeEventListener('mousewheel', MouseWheelHandler, false); //IE9, Chrome, Safari, Oper 1448 document.removeEventListener('wheel', MouseWheelHandler, false); //Firefox 1449 } else { 1450 document.detachEvent("onmousewheel", MouseWheelHandler); //IE 6/7/8 1451 } 1452 } 1453 1454 1455 /** 1456 * Adds the auto scrolling action for the mouse wheel and tackpad. 1457 * After this function is called, the mousewheel and trackpad movements will scroll through sections 1458 */ 1459 function addMouseWheelHandler(){ 1460 if (document.addEventListener) { 1461 document.addEventListener("mousewheel", MouseWheelHandler, false); //IE9, Chrome, Safari, Oper 1462 document.addEventListener("wheel", MouseWheelHandler, false); //Firefox 1463 } else { 1464 document.attachEvent("onmousewheel", MouseWheelHandler); //IE 6/7/8 1465 } 1466 } 1467 1468 1469 /** 1470 * Adds the possibility to auto scroll through sections on touch devices. 1471 */ 1472 function addTouchHandler(){ 1473 if(isTouchDevice || isTouch){ 1474 //Microsoft pointers 1475 MSPointer = getMSPointer(); 1476 1477 $(document).off('touchstart ' + MSPointer.down).on('touchstart ' + MSPointer.down, touchStartHandler); 1478 $(document).off('touchmove ' + MSPointer.move).on('touchmove ' + MSPointer.move, touchMoveHandler); 1479 } 1480 } 1481 1482 /** 1483 * Removes the auto scrolling for touch devices. 1484 */ 1485 function removeTouchHandler(){ 1486 if(isTouchDevice || isTouch){ 1487 //Microsoft pointers 1488 MSPointer = getMSPointer(); 1489 1490 $(document).off('touchstart ' + MSPointer.down); 1491 $(document).off('touchmove ' + MSPointer.move); 1492 } 1493 } 1494 1495 1496 /* 1497 * Returns and object with Microsoft pointers (for IE<11 and for IE >= 11) 1498 * http://msdn.microsoft.com/en-us/library/ie/dn304886(v=vs.85).aspx 1499 */ 1500 function getMSPointer(){ 1501 var pointer; 1502 1503 //IE >= 11 1504 if(window.PointerEvent){ 1505 pointer = { down: "pointerdown", move: "pointermove"}; 1506 } 1507 1508 //IE < 11 1509 else{ 1510 pointer = { down: "MSPointerDown", move: "MSPointerMove"}; 1511 } 1512 1513 return pointer; 1514 } 1515 /** 1516 * Gets the pageX and pageY properties depending on the browser. 1517 * https://github.com/alvarotrigo/fullPage.js/issues/194#issuecomment-34069854 1518 */ 1519 function getEventsPage(e){ 1520 var events = new Array(); 1521 if (window.navigator.msPointerEnabled){ 1522 events['y'] = e.pageY; 1523 events['x'] = e.pageX; 1524 }else{ 1525 events['y'] = e.touches[0].pageY; 1526 events['x'] = e.touches[0].pageX; 1527 } 1528 1529 return events; 1530 } 1531 1532 function silentLandscapeScroll(activeSlide){ 1533 var prevScrollingSpeepd = options.scrollingSpeed; 1534 $.fn.fullpage.setScrollingSpeed (0); 1535 landscapeScroll(activeSlide.closest('.fp-slides'), activeSlide); 1536 $.fn.fullpage.setScrollingSpeed(prevScrollingSpeepd); 1537 } 1538 1539 function silentScroll(top){ 1540 if (options.css3) { 1541 var translate3d = 'translate3d(0px, -' + top + 'px, 0px)'; 1542 transformContainer(translate3d, false); 1543 } 1544 else { 1545 container.css("top", -top); 1546 } 1547 } 1548 1549 function getTransforms(translate3d){ 1550 return { 1551 '-webkit-transform': translate3d, 1552 '-moz-transform': translate3d, 1553 '-ms-transform':translate3d, 1554 'transform': translate3d 1555 }; 1556 } 1557 1558 1559 /* 1560 * Destroys fullpage.js plugin events and optinally its html markup and styles 1561 */ 1562 $.fn.fullpage.destroy = function(all){ 1563 $.fn.fullpage.setAutoScrolling(false); 1564 $.fn.fullpage.setAllowScrolling(false); 1565 $.fn.fullpage.setKeyboardScrolling(false); 1566 1567 1568 $(window) 1569 .off('scroll', scrollHandler) 1570 .off('hashchange', hashChangeHandler) 1571 .off('resize', resizeHandler); 1572 1573 $(document) 1574 .off('click', '#fp-nav a') 1575 .off('mouseenter', '#fp-nav li') 1576 .off('mouseleave', '#fp-nav li')
1577 .off('click', '.fp-slidesNav a') 1578 .off('mouseover', options.normalScrollElements) 1579 .off('mouseout', options.normalScrollElements); 1580 1581 $('.fp-section') 1582 .off('click', '.fp-controlArrow'); 1583 1584 //lets make a mess! 1585 if(all){ 1586 destroyStructure(); 1587 } 1588 }; 1589 1590 /* 1591 * Removes inline styles added by fullpage.js 1592 */ 1593 function destroyStructure(){ 1594 //reseting the `top` or `translate` properties to 0 1595 silentScroll(0); 1596 1597 $('#fp-nav, .fp-slidesNav, .fp-controlArrow').remove(); 1598 1599 //removing inline styles 1600 $('.fp-section').css( { 1601 'height': '', 1602 'background-color' : '', 1603 'padding': '' 1604 }); 1605 1606 $('.fp-slide').css( { 1607 'width': '' 1608 }); 1609 1610 container.css({ 1611 'height': '', 1612 'position': '', 1613 '-ms-touch-action': '', 1614 'touch-action': '' 1615 }); 1616 1617 //removing added classes 1618 $('.fp-section, .fp-slide').each(function(){ 1619 removeSlimScroll($(this)); 1620 $(this).removeClass('fp-table active'); 1621 }) 1622 1623 container.find('.fp-easing').removeClass('fp-easing'); 1624 1625 //Unwrapping content 1626 container.find('.fp-tableCell, .fp-slidesContainer, .fp-slides').each(function(){ 1627 //unwrap not being use in case there's no child element inside and its just text 1628 $(this).replaceWith(this.childNodes); 1629 }); 1630 1631 //scrolling the page to the top with no animation 1632 $('html, body').scrollTop(0); 1633 } 1634 1635 }; 1636 1637})(jQuery);
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.