(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o'; container = document.getElementById('superContainer'); } //creating the navigation dots if (options.navigation) { var navHTML = document.createElement('div'); navHTML.innerHTML = ""; navHTML.setAttribute("id", "fullPage-nav"); docElemBody.appendChild(navHTML); var nav = document.getElementById("fullPage-nav"); nav.style.color = options.navigationColor; classie.addClass(nav,options.navigationPosition); } var sections = container.getElementsByClassName('section'); for(var index = 0; index < sections.length; index++){ var that = sections[index]; var $this = sections[index]; var slides = ($this !== 'undefined') ? $this.getElementsByClassName('slide') : 0; var numSlides = slides.length; //if no active section is defined, the 1st one will be the default one if(!index && document.getElementsByClassName('section active').length === 0) { classie.addClass($this,'active'); } if($this.style !== undefined){ $this.style.height = windowsHeight + 'px'; if(options.paddingTop || options.paddingBottom){ $this.style.padding = options.paddingTop + ' 0 ' + options.paddingBottom + ' 0'; } if (typeof options.slidesColor[index] !== 'undefined') { $this.style['background-color'] = options.slidesColor[index]; } } if (typeof options.anchors[index] !== 'undefined' && typeof $this === 'object' ) { $this.setAttribute('data-anchor', options.anchors[index]); } if (options.navigation) { var link = (options.anchors.length)? options.anchors[index]:'', tooltip = (typeof options.navigationTooltips[index] !== 'undefined')? options.navigationTooltips[index] : '', navToSetHTML = document.getElementById("fullPage-nav"), navUL = navToSetHTML.getElementsByTagName('ul')[0], newLIToAdd = document.createElement('li'); newLIToAdd.innerHTML=''; if(tooltip){ newLIToAdd.setAttribute('data-tooltip',tooltip); } navUL.appendChild(newLIToAdd); } // if there's any slide if (numSlides > 0) { var sliderWidth = numSlides * 100; var slideWidth = 100 / numSlides; var slidesContainerEl = document.createElement("div"); var slidesContainerForControlsEl = document.createElement("div"); slidesContainerEl.setAttribute('class','slidesContainer'); slidesContainerForControlsEl.setAttribute('class','slides'); elementContentWrapInner($this,slidesContainerEl); elementContentWrapInner($this,slidesContainerForControlsEl); $this.getElementsByClassName('slidesContainer')[0].style.width = sliderWidth + '%'; $this.innerHTML += ''; if(options.controlArrowColor!=='#fff'){ $this.getElementsByClassName('controlArrow next')[0].style['border-color'] = 'transparent transparent transparent '+options.controlArrowColor; $this.getElementsByClassName('controlArrow prev')[0].style['border-color'] = 'transparent transparent transparent '+options.controlArrowColor; } if(!options.loopHorizontal){ elementHideCss($this.getElementsByClassName('controlArrow prev')[0]); } if(options.slidesNavigation){ addSlidesNavigation($this, numSlides); } for(var i = 0; i< numSlides;i++){ //if the slide won#t be an starting point, the default will be the first one if(!i && $this.getElementsByClassName('slide active').length ===0){ classie.addClass($this.getElementsByClassName('slide')[0],'active'); } $this.getElementsByClassName('slide')[i].style.width=slideWidth + '%'; if(options.verticalCentered){ addTableClass($this.getElementsByClassName('slide')[i]); } } } else{ if(options.verticalCentered){ addTableClass($this); } } } this.setup(); }.bind(this); /** * finalizing the module for events */ this.setup = function(){ this.setAutoScrolling(options.autoScrolling); var nav = document.getElementById("fullPage-nav"); //the starting point is a slide? var activeSlide = document.getElementsByClassName('section active')[0].getElementsByClassName(' slide active')[0]; // console.log("activeSlide",activeSlide); if( typeof activeSlide !== 'undefined' && activeSlide.length && ( nodelistToArray(document.getElementsByClassName('section'),true).indexOf(activeSlide.outerHTML)/* $('.section.active').index('.section')*/ !== 0 || ( nodelistToArray(document.getElementsByClassName('section'),true).indexOf(activeSlide.outerHTML) /* $('.section.active').index('.section')*/ === 0 )/*&& activeSlide.index() !== 0 */) ){ var prevScrollingSpeepd = options.scrollingSpeed; this.setScrollingSpeed(0); landscapeScroll(document.getElementsByClassName('section active').getElementsByClassName('slides') , activeSlide); this.setScrollingSpeed(prevScrollingSpeepd); } // //fixed elements need to be moved out of the plugin container due to problems with CSS3. if(options.fixedElements && options.css3){ document.getElementsByTagName('body')[0].appendChild(document.querySelector(options.fixedElements)); } //vertical centered of the navigation + first bullet active if(options.navigation){ nav.style['margin-top'] = '-' + (nav.offsetHeight/2) + 'px'; var activeSection = nodelistToArray(document.getElementsByClassName('section'),true).indexOf(document.getElementsByClassName('section active')[0].outerHTML); var navigationATag = nav.getElementsByTagName('li')[activeSection].getElementsByTagName('a')[0]; classie.addClass(navigationATag,'active'); } //moving the menu outside the main container (avoid problems with fixed positions when using CSS3 tranforms) if(options.menu && options.css3){ document.getElementsByTagName('body')[0].appendChild(document.querySelector(options.menu)); } if(options.scrollOverflow){ //after DOM and images are loaded // if (document.readyState === "complete") { init(); } onWindowLoaded(function(){ var sections = document.getElementsByClassName('section'); for(var x=0; x < sections.length; x++){ var slides = sections[x].getElementsByClassName('slide'); var $this = sections[x]; if(slides.length){ for(var y=0; y< slides.length; y++){ // console.log(x,y,' slides'); createSlimScrolling(slides[y]); } } else{ // console.log(x,'no slides'); createSlimScrolling($this); } } if(typeof options.afterRender === "function"){ options.afterRender(); } }); } else{ if(typeof options.afterRender === "function"){ options.afterRender(); } } //getting the anchor link in the URL and deleting the `#` var value = window.location.hash.replace('#', '').split('/'); var destiny = value[0]; if(destiny.length){ var section = document.querySelector('[data-anchor="'+destiny+'"]'); if(!options.animateAnchor && section.length){ silentScroll( getPosition(section).top); if(typeof options.afterLoad === "function"){ options.afterLoad( destiny, (nodelistToArray(document.getElementsByClassName('section'),true).indexOf(section.outerHTML) + 1)); } //updating the active class var sectionColllection = document.getElementsByClassName('section'); for(var h =0; h (Math.abs(touchStartY - touchEndY))) { //is the movement greater than the minimum resistance to scroll? if (Math.abs(touchStartX - touchEndX) > (window.innerWidth / 100 * options.touchSensitivity)) { if (touchStartX > touchEndX) { this.moveSlideRight(); //next } else { this.moveSlideLeft(); //prev } } } //vertical scrolling (only when autoScrolling is enabled) else if(options.autoScrolling){ //if there are landscape slides, we check if the scrolling bar is in the current one or not if(activeSection.getElementsByClassName('slide').length){ scrollable= activeSection.querySelector('.slide.active').querySelector('.scrollable'); }else{ scrollable = activeSection.querySelector('.scrollable'); } //is the movement greater than the minimum resistance to scroll? if (Math.abs(touchStartY - touchEndY) > (window.innerHeight / 100 * options.touchSensitivity)) { if (touchStartY > touchEndY) { if(scrollable && scrollable.length > 0 ){ //is the scrollbar at the end of the scroll? if(isScrolled('bottom', scrollable)){ this.moveSectionDown(); }else{ return true; } }else{ // moved down this.moveSectionDown(); } } else if (touchEndY > touchStartY) { if(scrollable && scrollable.length > 0){ //is the scrollbar at the start of the scroll? if(isScrolled('top', scrollable)){ this.moveSectionUp(); } else{ return true; } }else{ // moved up this.moveSectionUp(); } } } } } } }.bind(this); /** * recursive function to loop up the parent nodes to check if one of them exists in options.normalScrollElements * Currently works well for iOS - Android might need some testing * @param {Element} el target element / jquery selector (in subsequent nodes) * @param {int} hop current hop compared to options.normalScrollElementTouchThreshold * @return {boolean} true if there is a match to options.normalScrollElements * @todo need to fix parent.isEqualNode to loop through selector of normalscrollelements called from @linotype~touchMoveHandler */ function checkParentForNormalScrollElement (el, hop) { hop = hop || 0; var parent = el.parentNode; if (hop < options.normalScrollElementTouchThreshold && parent.isEqualNode(document.querySelector(options.normalScrollElements)) ) { return true; } else if (hop === options.normalScrollElementTouchThreshold) { return false; } else { return checkParentForNormalScrollElement(parent, ++hop); } } /** * Retuns `up` or `down` depending on the scrolling movement to reach its destination * from the current section. */ function getYmovement(destiny){ var fromIndex = nodeIndexOfNodeList(document.getElementsByClassName('section'),document.getElementsByClassName('section active')[0]); //$('.section.active').index('.section'); var toIndex = nodeIndexOfNodeList(document.getElementsByClassName('section'),destiny);//destiny.index('.section'); if(fromIndex > toIndex){ return 'up'; } return 'down'; } /** * Retuns `right` or `left` depending on the scrolling movement to reach its destination * from the current slide. */ function getXmovement(fromIndex, toIndex){ if( fromIndex === toIndex){ return 'none'; } if(fromIndex > toIndex){ return 'left'; } return 'right'; } /** * Sliding with arrow keys, both, vertical and horizontal */ var keydownEvent = function(e){ console.log("keydownEvent",isMoving); if (options.keyboardScrolling && !isMoving) { switch (e.which) { //up case 38: case 33: this.moveSectionUp(); break; //down case 40: case 34: this.moveSectionDown(); break; //left case 37: this.moveSlideLeft(); break; //right case 39: this.moveSlideRight(); break; default: return; // exit this handler for other keys } } }.bind(this); /** * Removes the auto scrolling action fired by the mouse wheel and tackpad. * After this function is called, the mousewheel and trackpad movements won't scroll through sections. */ function removeMouseWheelHandler(){ if (document.addEventListener) { document.removeEventListener('mousewheel', MouseWheelHandler, false); //IE9, Chrome, Safari, Oper document.removeEventListener('wheel', MouseWheelHandler, false); //Firefox } else { document.detachEvent("onmousewheel", MouseWheelHandler); //IE 6/7/8 } } /** * Adds the auto scrolling action for the mouse wheel and tackpad. * After this function is called, the mousewheel and trackpad movements will scroll through sections */ function addMouseWheelHandler(){ if (document.addEventListener) { document.addEventListener("mousewheel", MouseWheelHandler, false); //IE9, Chrome, Safari, Oper document.addEventListener("wheel", MouseWheelHandler, false); //Firefox } else { document.attachEvent("onmousewheel", MouseWheelHandler); //IE 6/7/8 } } /** * Detecting mousewheel scrolling * * http://blogs.sitepointstatic.com/examples/tech/mouse-wheel/index.html * http://www.sitepoint.com/html5-javascript-mouse-wheel/ */ var MouseWheelHandler = function (e){ /* jshint debug:true */ // debugger; if(options.autoScrolling){ // cross-browser wheel delta e = window.event || e; var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.deltaY || -e.detail))); var scrollable; var activeSection = document.querySelector('.section.active'); if (!isMoving) { //if theres any # //if there are landscape slides, we check if the scrolling bar is in the current one or not if(activeSection.querySelectorAll('.slides').length){ console.log("has slides"); scrollable= activeSection.querySelector('.slide.active').querySelector('.scrollable'); }else{ console.log("on section"); scrollable = activeSection.querySelector('.scrollable'); // console.log("scrollable.length",(typeof scrollable.length)); } //scrolling down? if (delta < 0) { if(scrollable){ //is the scrollbar at the end of the scroll? if(isScrolled('bottom', scrollable)){ this.moveSectionDown(); }else{ return true; //normal scroll } }else{ this.moveSectionDown(); } } //scrolling up? else { if(scrollable){ //is the scrollbar at the start of the scroll? if(isScrolled('top', scrollable)){ this.moveSectionUp(); }else{ return true; //normal scroll } }else{ this.moveSectionUp(); } } } return false; } }.bind(this); /** handle updating window hash location */ function windowOnHashChangeEvent(e){ if(!isScrolling){ var value = window.location.hash.replace('#', '').split('/'); var section = value[0]; var slide = value[1]; //when moving to a slide in the first section for the first time (first time to add an anchor to the URL) var isFirstSlideMove = (typeof lastScrolledDestiny === 'undefined'); var isFirstScrollMove = (typeof lastScrolledDestiny === 'undefined' && typeof slide === 'undefined'); /*in order to call scrollpage() only once for each destination at a time It is called twice for each scroll otherwise, as in case of using anchorlinks `hashChange` event is fired on every scroll too.*/ if ((section && section !== lastScrolledDestiny) && !isFirstSlideMove || isFirstScrollMove || (!slideMoving && lastScrolledSlide !== slide )) { scrollPageAndSlide(section, slide); } } } //window scroll event function windowScrollEvent(e){ // console.log("window scroll"); var allSections = document.getElementsByClassName('section'); if(!options.autoScrolling){ var currentScroll = getScrollTop(window); var scrolledSections = []; nodelistToArray(document.querySelectorAll('.section')).map(function(mapIndex,index,arr){ var $this = mapIndex; if ($this.offsetTop< (currentScroll + 100)){ if($this){scrolledSections.push($this);} } }); //geting the last one, the current one on the screen var currentSectionIndex = scrolledSections.length-1; var currentSection = scrolledSections[currentSectionIndex]; // console.log("currentSection",currentSection); //executing only once the first time we reach the section if(!classie.hasClass(currentSection,'active')){ var leavingSection =nodeIndexOfNodeList(document.getElementsByClassName('section'),document.querySelector('.section.active')) +1; isScrolling = true; var yMovement = getYmovement(currentSection); removeAllClassAndToggle(currentSection,allSections,'active'); var anchorLink = currentSection.getAttribute('data-anchor'); if(typeof options.onLeave ==='function'){ options.onLeave.call(leavingSection, (currentSectionIndex + 1), yMovement); } activateMenuElement(anchorLink); activateNavDots(anchorLink, 0); if(options.anchors.length && !isMoving){ //needed to enter in hashChange event when using the menu with anchor links lastScrolledDestiny = anchorLink; location.hash = anchorLink; } //small timeout in order to avoid entering in hashChange event when scrolling is not finished yet clearTimeout(scrollId); scrollId = setTimeout(function(){ isScrolling = false; }, 100); } } } //navigation action function navigationClickEvent(e){ e.preventDefault(); var atarget = e.target.parentNode.parentNode; var allNavTargets = e.target.parentNode.parentNode.parentNode.children; var index = nodeIndexOfNodeList(allNavTargets,atarget); scrollPage(document.getElementsByClassName('section')[index]); } //slidenav click event function slideNavClickEvent(e){ e.preventDefault(); var etarget = e.target; if(etarget.tagName==='SPAN'){ var slides = document.querySelector('.section.active').querySelectorAll('.slide'), destiny; var slideLI = etarget.parentNode.parentNode; var allSlidesLI = etarget.parentNode.parentNode.parentNode.children; classie.addClass(slideLI,'clickedTarget'); destiny = slides[nodeIndexOfNodeList(allSlidesLI,slideLI)]; classie.removeClass(slideLI,'clickedTarget'); landscapeScroll(slides,destiny); } } //click events var sectionClickEvent = function(e){ var eventTarget = e.target; if(classie.hasClass(eventTarget,'controlArrow')){ if(classie.hasClass(eventTarget,'prev')){ this.moveSlideLeft(); } else{ this.moveSlideRight(); } } else if(classie.hasClass(eventTarget,'toSlide')){ e.preventDefault(); console.log("toSlide"); // var slides = $(this).closest('.section').find('.slides'); // var currentSlide = slides.find('.slide.active'); // var destiny = null; // destiny = slides.find('.slide').eq( ($(this).data('index') -1) ); // if(destiny.length > 0){ // landscapeScroll(slides, destiny); // } } }.bind(this); //window resize event function windowResizeEvent(e){ clearTimeout(resizeTimeout); resizeTimeout = setTimeout(doneResizing, 500); } //mobile orientation change function browserOnOrientationChange(e){ console.log("browserOnOrientationChange"); doneResizing(); } /** * When resizing is finished, we adjust the slides sizes and positions */ function doneResizing() { isResizing = true; var windowsWidth = window.innerWidth; windowsHeight = window.innerHeight; //text and images resizing if (options.resize) { resizeMe(windowsHeight, windowsWidth); } var allSections = document.getElementsByClassName('section'); for(var x = 0; x = scrollable.scrollHeight; } } /** * Activating the website main menu elements according to the given slide name. */ function activateMenuElement(name){ if(options.menu){ if(document.querySelector(options.menu).querySelector('.active')){ classie.removeClass(document.querySelector(options.menu).querySelector('.active'),'active'); } classie.addClass(document.querySelector(options.menu).querySelector('[data-menuanchor="'+name+'"]'),'active'); } } /** * createSlimScrolling */ function createSlimScrolling(element){ var section, sectionPaddingTop=0, sectionPaddingBottom=0; //needed to make `scrollHeight` work under Opera 12 element.style.overflow = 'hidden'; //in case element is a slide if(element.className.match(/slide/gi)){ var parentSectionOfSlide = getParentElement(element,'section'); // console.log("slide section:",parentSectionOfSlide); section = parentSectionOfSlide;//closetElement(parentSectionOfSlide); } else{ section = element;//closetElement(element); } var scrollable = element.getElementsByClassName('scrollable'),contentHeight; //if there was scroll, the contentHeight will be the one in the scrollable section if(scrollable.length){ contentHeight = element.getElementsByClassName('scrollable')[0].scrollHeight; } else{ if(options.verticalCentered){ contentHeight = element.getElementsByClassName('tableCell')[0].scrollHeight; } } var scrollHeight = getScrollHeight(section); //needs scroll? if ( contentHeight > scrollHeight) { //was there already an scroll ? Updating it if(scrollable.length){ scrollable[0].style.height= scrollHeight + 'px'; scrollable[0].parentNode.style.height= scrollHeight + 'px'; } //creating the scrolling else{ var scrollableEl = document.createElement("div"); scrollableEl.setAttribute('class','scrollable'); if(options.verticalCentered){ elementContentWrapInner(element.querySelector('.tableCell'),scrollableEl); }else{ elementContentWrapInner(element,scrollableEl); } var ss = new Slimscroll({ height: scrollHeight + 'px', size: '10px', alwaysVisible: true },element.getElementsByClassName('scrollable')); ss.init(); // element.find('.scrollable').slimScroll({ // height: scrollHeight + 'px', // size: '10px', // alwaysVisible: true // }); } } //removing the scrolling when it is not necessary anymore else{ if(element.getElementsByClassName('scrollable').children){ var scrollablefc = element.getElementsByClassName('scrollable').children.firstChild; unwrapElement(scrollablefc); unwrapElement(scrollablefc); // element.find('.scrollable').children().first().unwrap().unwrap(); } if(element.getElementsByClassName('slimScrollBar').parentNode){ // element.find('.slimScrollBar').remove(); var slimScrollBar = element.getElementsByClassName('slimScrollBar'); slimScrollBar.parentNode.removeChild(slimScrollBar); } if(element.getElementsByClassName('slimScrollRail').parentNode){ // element.find('.slimScrollRail').remove(); var slimScrollRail = element.getElementsByClassName('slimScrollRail'); slimScrollRail.parentNode.removeChild(slimScrollRail); } } //undo element.style.overflow=''; } function getScrollHeight(element){ var windowsHeight = window.innerHeight, sectionPaddingBottom = (element.style['padding-bottom'])? parseInt(element.style['padding-bottom'],10) :0, sectionPaddingTop = (element.style['padding-top'])? parseInt(element.style['padding-top'],10) :0; return (windowsHeight - sectionPaddingBottom - sectionPaddingTop); } /** * Scrolls horizontal sliders. */ function landscapeScroll(slides, destiny){ // console.log("landscapeScroll"); var destinyPos = getPosition(destiny), slidesContainer = destiny.parentNode, slideIndex = nodeIndexOfNodeList(slides,destiny), section = getParentElement(destiny,'section'), sectionIndex = nodeIndexOfNodeList(document.getElementsByClassName('section'),section), anchorLink = section.getAttribute('data-anchor'), slidesNav = section.querySelector('.fullPage-slidesNav'), slideAnchor = destiny.getAttribute('data-anchor'); //caching the value of isResizing at the momment the function is called //because it will be checked later inside a setTimeout and the value might change var localIsResizing = isResizing; if(options.onSlideLeave){ var prevSlideIndex = nodeIndexOfNodeList(section.querySelectorAll('.slide'),section.querySelector('.slide.active')); var xMovement = getXmovement(prevSlideIndex, slideIndex); //if the site is not just resizing and readjusting the slides if(!localIsResizing){ if(typeof options.onSlideLeave ==='function' ){ options.onSlideLeave.call( anchorLink, (sectionIndex + 1), prevSlideIndex, xMovement); } } } var elementCol = section.getElementsByClassName('slide'); removeAllClassAndToggle(destiny,elementCol,'active'); if(typeof slideAnchor === 'undefined' || slideAnchor === null){ slideAnchor = slideIndex; } //only changing the URL if the slides are in the current section (not for resize re-adjusting) if(classie.hasClass(section,'active')){ if(!options.loopHorizontal){ var prevarrow =section.querySelector('.controlArrow.prev'), nextarrow = section.querySelector('.controlArrow.next'); //hidding it for the fist slide, showing for the rest if(slideIndex!==0){ elementShowCss(prevarrow); } else{ elementHideCss(prevarrow); } //hidding it for the last slide, showing for the rest if(nodeIndexOfNodeList(elementCol,destiny) === elementCol.length-1){ elementHideCss(nextarrow); } else{ elementShowCss(nextarrow); } } setURLHash(slideIndex, slideAnchor, anchorLink); } if(options.css3){ var translate3d = 'translate3d(-' + destinyPos.left + 'px, 0px, 0px)'; // slides.find('.slidesContainer').toggleClass('easing', options.scrollingSpeed>0).css(getTransforms(translate3d)); classie.addClass( slidesContainer, 'easing' ); transformElement( translate3d, slidesContainer); setTimeout(function(){ //if the site is not just resizing and readjusting the slides if(!localIsResizing){ if(typeof options.afterSlideLoad ==='function'){ options.afterSlideLoad.call( this, anchorLink, (sectionIndex + 1), slideAnchor, slideIndex ); } } slideMoving = false; }, options.scrollingSpeed, options.easing); }else{ console.log("no css3 sub jquery animate"); slidesContainer.style.scrollLeft = destinyPos.left; //if the site is not just resizing and readjusting the slides if(!localIsResizing){ if(typeof options.afterSlideLoad ==='function' ){ options.afterSlideLoad.call( anchorLink, (sectionIndex + 1), slideAnchor, slideIndex);} } //letting them slide again slideMoving = false; } if(options.slidesNavigation){ classie.removeClass(slidesNav.querySelector('.active'),'active'); classie.addClass(slidesNav.querySelectorAll('li')[slideIndex].querySelector('a'),'active'); } } /** * Creates a landscape navigation bar with dots for horizontal sliders. @private @param {object} section - nodeelement to add navigation to @param {number} numSlides - number of slides */ function addSlidesNavigation(section, numSlides){ section.innerHTML+= '
    '; var nav = section.getElementsByClassName('fullPage-slidesNav')[0]; //top or bottom classie.addClass(nav,options.slidesNavPosition); for(var i=0; i< numSlides; i++){ nav.getElementsByTagName('ul')[0].innerHTML+='
  • '; } //centering it nav.style['margin-left'] = '-' + (nav.offsetWidth/2) + 'px'; classie.addClass(nav.getElementsByTagName('li')[0].getElementsByTagName('a')[0],'active'); } /** * adds table style to section * @private * @param { string } element - document element */ function addTableClass(element){ classie.addClass(element,'table'); var slidesTableContainerEl = document.createElement("div"); slidesTableContainerEl.setAttribute('class','tableCell'); slidesTableContainerEl.setAttribute('style',"height:" + getTableHeight(element) + "px;"); elementContentWrapInner(element,slidesTableContainerEl); } /** * get height for table * @private * @param { string } element - document element */ function getTableHeight(element){ var sectionHeight = windowsHeight; if(options.paddingTop || options.paddingBottom){ var section = element; if(!classie.hasClass(section,'section')){ section = element.closest('.section'); } var sectionPaddingBottom = (element.style['padding-bottom'])? parseInt(element.style['padding-bottom'],10) :0, sectionPaddingTop = (element.style['padding-top'])? parseInt(element.style['padding-top'],10) :0; sectionHeight = (windowsHeight - sectionPaddingBottom - sectionPaddingTop); } return sectionHeight; } /** * Checks for translate3d support * @return boolean * http://stackoverflow.com/questions/5661671/detecting-transform-translate3d-support */ function support3d() { var el = document.createElement('p'), has3d, transforms = { 'webkitTransform':'-webkit-transform', 'OTransform':'-o-transform', 'msTransform':'-ms-transform', 'MozTransform':'-moz-transform', 'transform':'transform' }; // Add it to the body to get the computed style. document.body.insertBefore(el, null); for (var t in transforms) { if (el.style[t] !== undefined) { el.style[t] = "translate3d(1px,1px,1px)"; has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]); } } document.body.removeChild(el); return (has3d !== undefined && has3d.length > 0 && has3d !== "none"); } /** * return browser preview for transforms. * @private * @param { string } translate3d - css transform propert */ function getTransforms(translate3d){ return { '-webkit-transform': translate3d, '-moz-transform': translate3d, '-ms-transform':translate3d, 'transform': translate3d }; } /** * Adds a css3 transform property to the container class with or without animation depending on the animated param. * @private */ function transformContainer(translate3d, animated){ // container.toggleClass('easing', animated); var transformsObject = getTransforms(translate3d); // container.css(getTransforms(translate3d)); for(var x in transformsObject){ container.style[x] = transformsObject[x]; } } function transformElement(translate3d,element){ // container.toggleClass('easing', animated); var transformsObject = getTransforms(translate3d); // container.css(getTransforms(translate3d)); for(var x in transformsObject){ element.style[x] = transformsObject[x]; } } /** * set the remove scrolling effect * @private * @param {number} top */ function silentScroll(top){ console.log("silentScroll"); if (options.css3) { var translate3d = 'translate3d(0px, -' + top + 'px, 0px)'; transformContainer(translate3d, false); } else { // container.css("top", -top); container.style.top = -top+'px'; } } }; module.exports = linotype; // If there is a window object, that at least has a document property, // define linotype if ( typeof window === "object" && typeof window.document === "object" ) { window.linotype = linotype; } },{"./domhelper":3,"./slimscroll":5,"classie":11,"events":6,"util":10,"util-extend":13}],5:[function(require,module,exports){ /* jshint debug:true */ /* * linotype * https://github.com/typesettin/linotype * @author yaw joseph etse * Copyright (c) 2014 Typesettin. All rights reserved. */ 'use strict'; var classie = require('classie'), extend = require('util-extend'), domhelper = require('./domhelper'); // events = require('events'), // util = require('util'); /** * creates slim scrollers. * @author yaw joseph etse * @module */ var slimscroll = function(options,elementsArray){ var defaults = { idSelector: 'body', width : 'auto',// width in pixels of the visible scroll area height : '250px',// height in pixels of the visible scroll area size : '7px',// width in pixels of the scrollbar and rail color: '#000',// scrollbar color, accepts any hex/color value position : 'right',// scrollbar position - left/right distance : '1px',// distance in pixels between the side edge and the scrollbar start : 'top',// default scroll position on load - top / bottom / $('selector') opacity : 0.4,// sets scrollbar opacity alwaysVisible : false,// enables always-on mode for the scrollbar disableFadeOut : false,// check if we should hide the scrollbar when user is hovering over railVisible : false,// sets visibility of the rail railColor : '#333',// sets rail color railOpacity : 0.2,// sets rail opacity railDraggable : true,// whether we should use jQuery UI Draggable to enable bar dragging railClass : 'slimScrollRail',// defautlt CSS class of the slimscroll rail barClass : 'slimScrollBar',// defautlt CSS class of the slimscroll bar wrapperClass : 'slimScrollDiv',// defautlt CSS class of the slimscroll wrapper allowPageScroll : false,// check if mousewheel should scroll the window if we reach top/bottom wheelStep : 20,// scroll amount applied to each mouse wheel step touchScrollStep : 200,// scroll amount applied when user is using gestures addedOriginalClass: 'originalScrollableElement', borderRadius: '7px',// sets border radius railBorderRadius : '7px'// sets border radius of the rail }, o = extend( defaults,options ), thisElements = (elementsArray) ? elementsArray : document.querySelectorAll(options.idSelector), me, rail, bar, barHeight, minBarHeight = 30, mousedownPageY, mousedownT, isDragg, currentBar, currentTouchDif, releaseScroll, isOverBar, percentScroll, queueHide, lastScroll, isOverPanel; this.init = function(){ // do it for every element that matches selector for(var x=0; x