(function($) {
$.fn.fullpage = function(options) {
options = $.extend({
"verticalCentered": true,
'resize': true,
'sectionsColor': [],
'anchors': [],
'scrollingSpeed': 700,
'easing': 'easeInQuart',
'menu': false,
'navigation': false,
'navigationPosition': 'right',
'navigationColor': '#000',
'navigationTooltips': [],
'slidesNavigation': false,
'slidesNavPosition': 'bottom',
'controlArrowColor': '#fff',
'loopBottom': false,
'loopTop': false,
'loopHorizontal': true,
'autoScrolling': true,
'scrollOverflow': false,
'css3': false,
'paddingTop': 0,
'paddingBottom': 0,
'fixedElements': null,
'normalScrollElements': null,
'keyboardScrolling': true,
'touchSensitivity': 5,
'continuousVertical': false,
'animateAnchor': true,
'normalScrollElementTouchThreshold': 5,
'sectionSelector': '.section',
'slideSelector': '.slide',
'afterLoad': null,
'onLeave': null,
'afterRender': null,
'afterResize': null,
'afterSlideLoad': null,
'onSlideLeave': null
}, options);
if (options.continuousVertical && (options.loopTop || options.loopBottom)) {
options.continuousVertical = false;
console && console.log && console.log("Option loopTop/loopBottom is mutually exclusive with continuousVertical; continuousVertical disabled");
}
var scrollDelay = 600;
$.fn.fullpage.setAutoScrolling = function(value) {
options.autoScrolling = value;
var element = $('.fp-section.active');
if (options.autoScrolling) {
$('html, body').css({
'overflow': 'hidden',
'height': '100%'
});
container.css({
'-ms-touch-action': 'none',
'touch-action': 'none'
});
if (element.length) {
silentScroll(element.position().top);
}
} else {
$('html, body').css({
'overflow': 'visible',
'height': 'initial'
});
container.css({
'-ms-touch-action': '',
'touch-action': ''
});
silentScroll(0);
$('html, body').scrollTop(element.position().top);
}
};
$.fn.fullpage.setScrollingSpeed = function(value) {
options.scrollingSpeed = value;
};
$.fn.fullpage.setMouseWheelScrolling = function(value) {
if (value) {
addMouseWheelHandler();
} else {
removeMouseWheelHandler();
}
};
$.fn.fullpage.setAllowScrolling = function(value) {
if (value) {
$.fn.fullpage.setMouseWheelScrolling(true);
addTouchHandler();
} else {
$.fn.fullpage.setMouseWheelScrolling(false);
removeTouchHandler();
}
};
$.fn.fullpage.setKeyboardScrolling = function(value) {
options.keyboardScrolling = value;
};
var slideMoving = false;
var isTouchDevice = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|BB10|Windows Phone|Tizen|Bada)/);
var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0));
var container = $(this);
var windowsHeight = $(window).height();
var isMoving = false;
var isResizing = false;
var lastScrolledDestiny;
var lastScrolledSlide;
var nav;
var wrapperSelector = 'fullpage-wrapper';
$.fn.fullpage.setAllowScrolling(true);
if (options.css3) {
options.css3 = support3d();
}
if ($(this).length) {
container.css({
'height': '100%',
'position': 'relative'
});
container.addClass(wrapperSelector);
} else {
console.error("Error! Fullpage.js needs to be initialized with a selector. For example: $('#myContainer').fullpage();");
}
$(options.sectionSelector).each(function() {
$(this).addClass('fp-section');
});
$(options.slideSelector).each(function() {
$(this).addClass('fp-slide');
});
if (options.navigation) {
addVerticalNavigation();
}
$('.fp-section').each(function(index) {
var that = $(this);
var slides = $(this).find('.fp-slide');
var numSlides = slides.length;
if (!index && $('.fp-section.active').length === 0) {
$(this).addClass('active');
}
$(this).css('height', windowsHeight + 'px');
if (options.paddingTop || options.paddingBottom) {
$(this).css('padding', options.paddingTop + ' 0 ' + options.paddingBottom + ' 0');
}
if (typeof options.sectionsColor[index] !== 'undefined') {
$(this).css('background-color', options.sectionsColor[index]);
}
if (typeof options.anchors[index] !== 'undefined') {
$(this).attr('data-anchor', options.anchors[index]);
}
if (numSlides > 1) {
var sliderWidth = numSlides * 100;
var slideWidth = 100 / numSlides;
slides.wrapAll('
');
slides.parent().wrap('');
$(this).find('.fp-slidesContainer').css('width', sliderWidth + '%');
$(this).find('.fp-slides').after('
');
if (options.controlArrowColor != '#fff') {
$(this).find('.fp-controlArrow.fp-next').css('border-color', 'transparent transparent transparent ' + options.controlArrowColor);
$(this).find('.fp-controlArrow.fp-prev').css('border-color', 'transparent ' + options.controlArrowColor + ' transparent transparent');
}
if (!options.loopHorizontal) {
$(this).find('.fp-controlArrow.fp-prev').hide();
}
if (options.slidesNavigation) {
addSlidesNavigation($(this), numSlides);
}
slides.each(function(index) {
var imageUrl = $(this).data('slide-bg');
$(this).css('width', slideWidth + '%');
$(this).css('background-image', 'url(' + imageUrl + ')');
if (options.verticalCentered) {
addTableClass($(this));
}
});
var startingSlide = that.find('.fp-slide.active');
if (startingSlide.length == 0) {
slides.eq(0).addClass('active');
} else {
silentLandscapeScroll(startingSlide);
}
} else {
if (options.verticalCentered) {
addTableClass($(this));
}
}
}).promise().done(function() {
$.fn.fullpage.setAutoScrolling(options.autoScrolling);
var activeSlide = $('.fp-section.active').find('.fp-slide.active');
if (activeSlide.length && ($('.fp-section.active').index('.fp-section') != 0 || ($('.fp-section.active').index('.fp-section') == 0 && activeSlide.index() != 0))) {
silentLandscapeScroll(activeSlide);
}
if (options.fixedElements && options.css3) {
$(options.fixedElements).appendTo('body');
}
if (options.navigation) {
nav.css('margin-top', '-' + (nav.height() / 2) + 'px');
nav.find('li').eq($('.fp-section.active').index('.fp-section')).find('a').addClass('active');
}
if (options.menu && options.css3 && $(options.menu).closest('.fullpage-wrapper').length) {
$(options.menu).appendTo('body');
}
if (options.scrollOverflow) {
if (container.hasClass('fullpage-used')) {
createSlimScrollingHandler();
}
$(window).on('load', createSlimScrollingHandler);
} else {
$.isFunction(options.afterRender) && options.afterRender.call(this);
}
var value = window.location.hash.replace('#', '').split('/');
var destiny = value[0];
if (destiny.length) {
var section = $('[data-anchor="' + destiny + '"]');
if (!options.animateAnchor && section.length) {
if (options.autoScrolling) {
silentScroll(section.position().top);
} else {
silentScroll(0);
$('html, body').scrollTop(section.position().top);
}
activateMenuElement(destiny);
activateNavDots(destiny, null);
$.isFunction(options.afterLoad) && options.afterLoad.call(this, destiny, (section.index('.fp-section') + 1));
section.addClass('active').siblings().removeClass('active');
}
}
$(window).on('load', function() {
scrollToAnchor();
});
});
function pad(str, max) {
str = str.toString();
return str.length < max ? pad("0" + str, max) : str;
}
function addVerticalNavigation() {
$('body').append('');
nav = $('#fp-nav');
nav.css('color', options.navigationColor);
nav.addClass(options.navigationPosition);
for (var cont = 0; cont < $('.fp-section').length; cont++) {
var link = '';
if (options.anchors.length) {
link = options.anchors[cont];
}
var tooltip = options.navigationTooltips[cont];
if (typeof tooltip === 'undefined') {
tooltip = '';
}
nav.find('ul').append('' + pad(cont+1, 2) + '');
}
}
function createSlimScrollingHandler() {
$('.fp-section').each(function() {
var slides = $(this).find('.fp-slide');
if (slides.length) {
slides.each(function() {
createSlimScrolling($(this));
});
} else {
createSlimScrolling($(this));
}
});
$.isFunction(options.afterRender) && options.afterRender.call(this);
}
var scrollId;
var isScrolling = false;
$(window).on('scroll', scrollHandler);
function scrollHandler() {
if (!options.autoScrolling) {
var currentScroll = $(window).scrollTop();
var scrolledSections = $('.fp-section').map(function() {
if ($(this).offset().top < (currentScroll + 100)) {
return $(this);
}
});
var currentSection = scrolledSections[scrolledSections.length - 1];
if (!currentSection.hasClass('active')) {
isScrolling = true;
var leavingSection = $('.fp-section.active').index('.fp-section') + 1;
var yMovement = getYmovement(currentSection);
var anchorLink = currentSection.data('anchor');
currentSection.addClass('active').siblings().removeClass('active');
$.isFunction(options.onLeave) && options.onLeave.call(this, leavingSection, (currentSection.index('.fp-section') + 1), yMovement);
$.isFunction(options.afterLoad) && options.afterLoad.call(this, anchorLink, (currentSection.index('.fp-section') + 1));
activateMenuElement(anchorLink);
activateNavDots(anchorLink, 0);
if (options.anchors.length && !isMoving) {
lastScrolledDestiny = anchorLink;
location.hash = anchorLink;
}
clearTimeout(scrollId);
scrollId = setTimeout(function() {
isScrolling = false;
}, 100);
}
}
}
function isScrollable(activeSection) {
if (activeSection.find('.fp-slides').length) {
scrollable = activeSection.find('.fp-slide.active').find('.fp-scrollable');
} else {
scrollable = activeSection.find('.fp-scrollable');
}
return scrollable;
}
function scrolling(type, scrollable) {
if (type == 'down') {
var check = 'bottom';
var scrollSection = $.fn.fullpage.moveSectionDown;
} else {
var check = 'top';
var scrollSection = $.fn.fullpage.moveSectionUp;
}
if (scrollable.length > 0) {
if (isScrolled(check, scrollable)) {
scrollSection();
} else {
return true;
}
} else {
scrollSection();
}
}
var touchStartY = 0;
var touchStartX = 0;
var touchEndY = 0;
var touchEndX = 0;
function touchMoveHandler(event) {
var e = event.originalEvent;
if (options.autoScrolling) {
event.preventDefault();
}
if (!checkParentForNormalScrollElement(event.target)) {
var touchMoved = false;
var activeSection = $('.fp-section.active');
var scrollable = isScrollable(activeSection);
if (!isMoving && !slideMoving) {
var touchEvents = getEventsPage(e);
touchEndY = touchEvents['y'];
touchEndX = touchEvents['x'];
if (activeSection.find('.fp-slides').length && Math.abs(touchStartX - touchEndX) > (Math.abs(touchStartY - touchEndY))) {
if (Math.abs(touchStartX - touchEndX) > ($(window).width() / 100 * options.touchSensitivity)) {
if (touchStartX > touchEndX) {
$.fn.fullpage.moveSlideRight();
} else {
$.fn.fullpage.moveSlideLeft();
}
}
} else if (options.autoScrolling) {
if (Math.abs(touchStartY - touchEndY) > ($(window).height() / 100 * options.touchSensitivity)) {
if (touchStartY > touchEndY) {
scrolling('down', scrollable);
} else if (touchEndY > touchStartY) {
scrolling('up', scrollable);
}
}
}
}
}
}
function checkParentForNormalScrollElement(el, hop) {
hop = hop || 0;
var parent = $(el).parent();
if (hop < options.normalScrollElementTouchThreshold && parent.is(options.normalScrollElements)) {
return true;
} else if (hop == options.normalScrollElementTouchThreshold) {
return false;
} else {
return checkParentForNormalScrollElement(parent, ++hop);
}
}
function touchStartHandler(event) {
var e = event.originalEvent;
var touchEvents = getEventsPage(e);
touchStartY = touchEvents['y'];
touchStartX = touchEvents['x'];
}
function MouseWheelHandler(e) {
if (options.autoScrolling) {
e = window.event || e;
var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.deltaY || -e.detail)));
var activeSection = $('.fp-section.active');
var scrollable = isScrollable(activeSection);
if (!isMoving) {
if (delta < 0) {
scrolling('down', scrollable);
} else {
scrolling('up', scrollable);
}
}
return false;
}
}
$.fn.fullpage.moveSectionUp = function() {
var prev = $('.fp-section.active').prev('.fp-section');
if (!prev.length && (options.loopTop || options.continuousVertical)) {
prev = $('.fp-section').last();
}
if (prev.length) {
scrollPage(prev, null, true);
}
};
$.fn.fullpage.moveSectionDown = function() {
var next = $('.fp-section.active').next('.fp-section');
if (!next.length && (options.loopBottom || options.continuousVertical)) {
next = $('.fp-section').first();
}
if (next.length) {
scrollPage(next, null, false);
}
};
$.fn.fullpage.moveToFirst = function() {
var first = $('.fp-section').first();
scrollPage(first, null, false);
};
$.fn.fullpage.moveTo = function(section, slide) {
var destiny = '';
if (isNaN(section)) {
destiny = $('[data-anchor="' + section + '"]');
} else {
destiny = $('.fp-section').eq((section - 1));
}
if (typeof slide !== 'undefined') {
scrollPageAndSlide(section, slide);
} else if (destiny.length > 0) {
scrollPage(destiny);
}
};
$.fn.fullpage.moveSlideRight = function() {
moveSlide('next');
};
$.fn.fullpage.moveSlideLeft = function() {
moveSlide('prev');
};
function moveSlide(direction) {
var activeSection = $('.fp-section.active');
var slides = activeSection.find('.fp-slides');
if (!slides.length || slideMoving) {
return;
}
var currentSlide = slides.find('.fp-slide.active');
var destiny = null;
if (direction === 'prev') {
destiny = currentSlide.prev('.fp-slide');
} else {
destiny = currentSlide.next('.fp-slide');
}
if (!destiny.length) {
if (!options.loopHorizontal) return;
if (direction === 'prev') {
destiny = currentSlide.siblings(':last');
} else {
destiny = currentSlide.siblings(':first');
}
}
slideMoving = true;
landscapeScroll(slides, destiny);
}
function keepSlidesPosition() {
$('.fp-slide.active').each(function() {
silentLandscapeScroll($(this));
});
}
function scrollPage(element, callback, isMovementUp) {
var scrollOptions = {},
scrolledElement;
var dest = element.position();
if (typeof dest === "undefined") {
return;
}
var dtop = dest.top;
var yMovement = getYmovement(element);
var anchorLink = element.data('anchor');
var sectionIndex = element.index('.fp-section');
var activeSlide = element.find('.fp-slide.active');
var activeSection = $('.fp-section.active');
var leavingSection = activeSection.index('.fp-section') + 1;
var localIsResizing = isResizing;
if (activeSlide.length) {
var slideAnchorLink = activeSlide.data('anchor');
var slideIndex = activeSlide.index();
}
if (options.autoScrolling && options.continuousVertical && typeof(isMovementUp) !== "undefined" && ((!isMovementUp && yMovement == 'up') || (isMovementUp && yMovement == 'down'))) {
if (!isMovementUp) {
$(".fp-section.active").after(activeSection.prevAll(".fp-section").get().reverse());
} else {
$(".fp-section.active").before(activeSection.nextAll(".fp-section"));
}
silentScroll($('.fp-section.active').position().top);
keepSlidesPosition();
var wrapAroundElements = activeSection;
dest = element.position();
dtop = dest.top;
yMovement = getYmovement(element);
}
element.addClass('active').siblings().removeClass('active');
pauseAllVideos('.fp-section');
playVideo(element);
isMoving = true;
if (typeof anchorLink !== 'undefined') {
setURLHash(slideIndex, slideAnchorLink, anchorLink);
}
if (options.autoScrolling) {
scrollOptions['top'] = -dtop;
scrolledElement = '.' + wrapperSelector;
} else {
scrollOptions['scrollTop'] = dtop;
scrolledElement = 'html, body';
}
var continuousVerticalFixSectionOrder = function() {
if (!wrapAroundElements || !wrapAroundElements.length) {
return;
}
if (isMovementUp) {
$('.fp-section:first').before(wrapAroundElements);
} else {
$('.fp-section:last').after(wrapAroundElements);
}
silentScroll($('.fp-section.active').position().top);
keepSlidesPosition();
};
var afterSectionLoads = function() {
continuousVerticalFixSectionOrder();
$.isFunction(options.afterLoad) && !localIsResizing && options.afterLoad.call(this, anchorLink, (sectionIndex + 1));
setTimeout(function() {
isMoving = false;
$.isFunction(callback) && callback.call(this);
//------------------------------------------
//alert('SCROLL-END ' + sectionIndex);
if(sectionIndex>(custom_fp_slide_count-1) && custom_fp_active==1) {
//WILLEM
//$.fn.fullpage.reBuild();
$.fn.fullpage.destroy(true);
custom_fp_active = 0;
//REFRESH WAYPOINTS
Waypoint.refreshAll();
//console.log('OK');
//RESIZE PORTFOLIO
$grid.masonry('layout');
//$grid.masonry()
//scrollspy activeren of refreshen
//$('body').scrollspy({ target: '#navbar-body' });
$('[data-spy="scroll"]').each(function () {
var $spy = $(this).scrollspy('refresh')
})
//FULLPAGE IS UITGESCHAKELD!
//NU voorlaatste slide ALS ACTIEF ZETTEN ZODAT BIJ HET WEER ACTIVEREN AUTOMATISCH DAAR WEER BEGINT!!
//fp-section.active
$('.lastfullpage-slide').addClass('fp-section').addClass('active');
//alert('DE-ACTIVEREN!');
//destroyStructure()
}
//------------------------------------------
}, scrollDelay);
}
$.isFunction(options.onLeave) && !localIsResizing && options.onLeave.call(this, leavingSection, (sectionIndex + 1), yMovement);
if (options.css3 && options.autoScrolling) {
var translate3d = 'translate3d(0px, -' + dtop + 'px, 0px)';
transformContainer(translate3d, true);
setTimeout(function() {
afterSectionLoads();
}, options.scrollingSpeed);
} else {
$(scrolledElement).animate(scrollOptions, options.scrollingSpeed, options.easing, function() {
afterSectionLoads();
});
}
lastScrolledDestiny = anchorLink;
if (options.autoScrolling) {
activateMenuElement(anchorLink);
activateNavDots(anchorLink, sectionIndex);
}
}
function scrollToAnchor() {
var value = window.location.hash.replace('#', '').split('/');
var section = value[0];
var slide = value[1];
if (section) {
scrollPageAndSlide(section, slide);
}
}
$(window).on('hashchange', hashChangeHandler);
function hashChangeHandler() {
if (!isScrolling) {
var value = window.location.hash.replace('#', '').split('/');
var section = value[0];
var slide = value[1];
if (section.length) {
var isFirstSlideMove = (typeof lastScrolledDestiny === 'undefined');
var isFirstScrollMove = (typeof lastScrolledDestiny === 'undefined' && typeof slide === 'undefined' && !slideMoving);
if ((section && section !== lastScrolledDestiny) && !isFirstSlideMove || isFirstScrollMove || (!slideMoving && lastScrolledSlide != slide)) {
scrollPageAndSlide(section, slide);
}
}
}
}
$(document).keydown(function(e) {
if (options.keyboardScrolling && !isMoving) {
switch (e.which) {
case 38:
case 33:
$.fn.fullpage.moveSectionUp();
break;
case 40:
case 34:
$.fn.fullpage.moveSectionDown();
break;
case 36:
$.fn.fullpage.moveTo(1);
break;
case 35:
$.fn.fullpage.moveTo($('.fp-section').length);
break;
case 37:
$.fn.fullpage.moveSlideLeft();
break;
case 39:
$.fn.fullpage.moveSlideRight();
break;
default:
return;
}
}
});
$(document).on('click', '#fp-nav a', function(e) {
e.preventDefault();
var index = $(this).parent().index();
scrollPage($('.fp-section').eq(index));
});
$(document).on({
mouseenter: function() {
var tooltip = $(this).data('tooltip');
$('' + tooltip + '
').hide().appendTo($(this)).fadeIn(200);
},
mouseleave: function() {
$(this).find('.fp-tooltip').fadeOut(200, function() {
$(this).remove();
});
}
}, '#fp-nav li');
if (options.normalScrollElements) {
$(document).on('mouseenter', options.normalScrollElements, function() {
$.fn.fullpage.setMouseWheelScrolling(false);
});
$(document).on('mouseleave', options.normalScrollElements, function() {
$.fn.fullpage.setMouseWheelScrolling(true);
});
}
$('.fp-section').on('click', '.fp-controlArrow', function() {
if ($(this).hasClass('fp-prev')) {
$.fn.fullpage.moveSlideLeft();
} else {
$.fn.fullpage.moveSlideRight();
}
});
$('.fp-section').on('click', '.toSlide', function(e) {
e.preventDefault();
var slides = $(this).closest('.fp-section').find('.fp-slides');
var currentSlide = slides.find('.fp-slide.active');
var destiny = null;
destiny = slides.find('.fp-slide').eq(($(this).data('index') - 1));
if (destiny.length > 0) {
landscapeScroll(slides, destiny);
}
});
function landscapeScroll(slides, destiny) {
var destinyPos = destiny.position();
var slidesContainer = slides.find('.fp-slidesContainer').parent();
var slideIndex = destiny.index();
var section = slides.closest('.fp-section');
var sectionIndex = section.index('.fp-section');
var anchorLink = section.data('anchor');
var slidesNav = section.find('.fp-slidesNav');
var slideAnchor = destiny.data('anchor');
var localIsResizing = isResizing;
if (options.onSlideLeave) {
var prevSlideIndex = section.find('.fp-slide.active').index();
var xMovement = getXmovement(prevSlideIndex, slideIndex);
if (!localIsResizing) {
$.isFunction(options.onSlideLeave) && options.onSlideLeave.call(this, anchorLink, (sectionIndex + 1), prevSlideIndex, xMovement);
}
}
destiny.addClass('active').siblings().removeClass('active');
if (typeof slideAnchor === 'undefined') {
slideAnchor = slideIndex;
}
if (!options.loopHorizontal) {
section.find('.fp-controlArrow.fp-prev').toggle(slideIndex != 0);
section.find('.fp-controlArrow.fp-next').toggle(!destiny.is(':last-child'));
}
if (section.hasClass('active')) {
setURLHash(slideIndex, slideAnchor, anchorLink);
}
var afterSlideLoads = function() {
if (!localIsResizing) {
$.isFunction(options.afterSlideLoad) && options.afterSlideLoad.call(this, anchorLink, (sectionIndex + 1), slideAnchor, slideIndex);
}
slideMoving = false;
};
if (options.css3) {
var translate3d = 'translate3d(-' + destinyPos.left + 'px, 0px, 0px)';
slides.find('.fp-slidesContainer').toggleClass('fp-easing', options.scrollingSpeed > 0).css(getTransforms(translate3d));
setTimeout(function() {
afterSlideLoads();
}, options.scrollingSpeed, options.easing);
} else {
slidesContainer.animate({
scrollLeft: destinyPos.left
}, options.scrollingSpeed, options.easing, function() {
afterSlideLoads();
});
}
slidesNav.find('.active').removeClass('active');
slidesNav.find('li').eq(slideIndex).find('a').addClass('active');
}
$(window).resize(resizeHandler);
var resizeId;
function resizeHandler() {
if (isTouchDevice) {
$.fn.fullpage.reBuild();
} else {
clearTimeout(resizeId);
resizeId = setTimeout($.fn.fullpage.reBuild, 500);
}
}
$.fn.fullpage.reBuild = function() {
isResizing = true;
var windowsWidth = $(window).width();
windowsHeight = $(window).height();
if (options.resize) {
resizeMe(windowsHeight, windowsWidth);
}
$('.fp-section').each(function() {
var scrollHeight = windowsHeight - parseInt($(this).css('padding-bottom')) - parseInt($(this).css('padding-top'));
if (options.verticalCentered) {
$(this).find('.fp-tableCell').css('height', getTableHeight($(this)) + 'px');
}
$(this).css('height', windowsHeight + 'px');
if (options.scrollOverflow) {
var slides = $(this).find('.fp-slide');
if (slides.length) {
slides.each(function() {
createSlimScrolling($(this));
});
} else {
createSlimScrolling($(this));
}
}
var slides = $(this).find('.fp-slides');
if (slides.length) {
landscapeScroll(slides, slides.find('.fp-slide.active'));
}
});
var destinyPos = $('.fp-section.active').position();
var activeSection = $('.fp-section.active');
if (activeSection.index('.fp-section')) {
scrollPage(activeSection);
}
isResizing = false;
$.isFunction(options.afterResize) && options.afterResize.call(this);
}
function resizeMe(displayHeight, displayWidth) {
var preferredHeight = 825;
var preferredWidth = 900;
if (displayHeight < preferredHeight || displayWidth < preferredWidth) {
var heightPercentage = (displayHeight * 100) / preferredHeight;
var widthPercentage = (displayWidth * 100) / preferredWidth;
var percentage = Math.min(heightPercentage, widthPercentage);
var newFontSize = percentage.toFixed(2);
$("body").css("font-size", newFontSize + '%');
} else {
$("body").css("font-size", '100%');
}
}
function activateNavDots(name, sectionIndex) {
if (options.navigation) {
$('#fp-nav').find('.active').removeClass('active');
if (name) {
$('#fp-nav').find('a[href="#' + name + '"]').addClass('active');
} else {
$('#fp-nav').find('li').eq(sectionIndex).find('a').addClass('active');
}
//if(sectionIndex==6) {}
}
}
function activateMenuElement(name) {
if (options.menu) {
$(options.menu).find('.active').removeClass('active');
$(options.menu).find('[data-menuanchor="' + name + '"]').addClass('active');
}
}
function isScrolled(type, scrollable) {
if (type === 'top') {
return !scrollable.scrollTop();
} else if (type === 'bottom') {
return scrollable.scrollTop() + 1 + scrollable.innerHeight() >= scrollable[0].scrollHeight;
}
}
function getYmovement(destiny) {
var fromIndex = $('.fp-section.active').index('.fp-section');
var toIndex = destiny.index('.fp-section');
if (fromIndex > toIndex) {
return 'up';
}
return 'down';
}
function getXmovement(fromIndex, toIndex) {
if (fromIndex == toIndex) {
return 'none'
}
if (fromIndex > toIndex) {
return 'left';
}
return 'right';
}
function createSlimScrolling(element) {
element.css('overflow', 'hidden');
var section = element.closest('.fp-section');
var scrollable = element.find('.fp-scrollable');
if (scrollable.length) {
var contentHeight = scrollable.get(0).scrollHeight;
} else {
var contentHeight = element.get(0).scrollHeight;
if (options.verticalCentered) {
contentHeight = element.find('.fp-tableCell').get(0).scrollHeight;
}
}
var scrollHeight = windowsHeight - parseInt(section.css('padding-bottom')) - parseInt(section.css('padding-top'));
if (contentHeight > scrollHeight) {
if (scrollable.length) {
scrollable.css('height', scrollHeight + 'px').parent().css('height', scrollHeight + 'px');
} else {
if (options.verticalCentered) {
element.find('.fp-tableCell').wrapInner('');
} else {
element.wrapInner('');
}
element.find('.fp-scrollable').slimScroll({
allowPageScroll: true,
height: scrollHeight + 'px',
size: '10px',
alwaysVisible: true
});
}
} else {
removeSlimScroll(element);
}
element.css('overflow', '');
}
function removeSlimScroll(element) {
element.find('.fp-scrollable').children().first().unwrap().unwrap();
element.find('.slimScrollBar').remove();
element.find('.slimScrollRail').remove();
}
function addTableClass(element) {
if (element.hasClass('format-video') && element.find('.capitalVideoWrap').length) {
element.addClass('fp-table').wrapInner('');
element.prepend('');
} else {
element.addClass('fp-table').wrapInner('');
}
}
function getTableHeight(element) {
var sectionHeight = windowsHeight;
if (options.paddingTop || options.paddingBottom) {
var section = element;
if (!section.hasClass('fp-section')) {
section = element.closest('.fp-section');
}
var paddings = parseInt(section.css('padding-top')) + parseInt(section.css('padding-bottom'));
sectionHeight = (windowsHeight - paddings);
}
return sectionHeight;
}
function transformContainer(translate3d, animated) {
container.toggleClass('fp-easing', animated);
container.css(getTransforms(translate3d));
}
function scrollPageAndSlide(destiny, slide) {
if (typeof slide === 'undefined') {
slide = 0;
}
if (isNaN(destiny)) {
var section = $('[data-anchor="' + destiny + '"]');
} else {
var section = $('.fp-section').eq((destiny - 1));
}
if (destiny !== lastScrolledDestiny && !section.hasClass('active')) {
scrollPage(section, function() {
scrollSlider(section, slide)
});
} else {
scrollSlider(section, slide);
}
}
function scrollSlider(section, slide) {
if (typeof slide != 'undefined') {
var slides = section.find('.fp-slides');
var destiny = slides.find('[data-anchor="' + slide + '"]');
if (!destiny.length) {
destiny = slides.find('.fp-slide').eq(slide);
}
if (destiny.length) {
landscapeScroll(slides, destiny);
}
}
}
function addSlidesNavigation(section, numSlides) {
section.append('');
var nav = section.find('.fp-slidesNav');
nav.addClass(options.slidesNavPosition);
for (var i = 0; i < numSlides; i++) {
nav.find('ul').append('');
}
nav.css('margin-left', '-' + (nav.width() / 2) + 'px');
nav.find('li').first().find('a').addClass('active');
}
function setURLHash(slideIndex, slideAnchor, anchorLink) {
var sectionHash = '';
if (options.anchors.length) {
if (slideIndex) {
if (typeof anchorLink !== 'undefined') {
sectionHash = anchorLink;
}
if (typeof slideAnchor === 'undefined') {
slideAnchor = slideIndex;
}
lastScrolledSlide = slideAnchor;
location.hash = sectionHash + '/' + slideAnchor;
} else if (typeof slideIndex !== 'undefined') {
lastScrolledSlide = slideAnchor;
location.hash = anchorLink;
} else {
location.hash = anchorLink;
}
}
}
$(document).on('click', '.fp-slidesNav a', function(e) {
e.preventDefault();
var slides = $(this).closest('.fp-section').find('.fp-slides');
var destiny = slides.find('.fp-slide').eq($(this).closest('li').index());
landscapeScroll(slides, destiny);
});
function support3d() {
var el = document.createElement('p'),
has3d, transforms = {
'webkitTransform': '-webkit-transform',
'OTransform': '-o-transform',
'msTransform': '-ms-transform',
'MozTransform': '-moz-transform',
'transform': 'transform'
};
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");
}
function removeMouseWheelHandler() {
if (document.addEventListener) {
document.removeEventListener('mousewheel', MouseWheelHandler, false);
document.removeEventListener('wheel', MouseWheelHandler, false);
} else {
document.detachEvent("onmousewheel", MouseWheelHandler);
}
}
function addMouseWheelHandler() {
if (document.addEventListener) {
document.addEventListener("mousewheel", MouseWheelHandler, false);
document.addEventListener("wheel", MouseWheelHandler, false);
} else {
document.attachEvent("onmousewheel", MouseWheelHandler);
}
}
function addTouchHandler() {
if (isTouchDevice || isTouch) {
MSPointer = getMSPointer();
$(document).off('touchstart ' + MSPointer.down).on('touchstart ' + MSPointer.down, touchStartHandler);
$(document).off('touchmove ' + MSPointer.move).on('touchmove ' + MSPointer.move, touchMoveHandler);
}
}
function removeTouchHandler() {
if (isTouchDevice || isTouch) {
MSPointer = getMSPointer();
$(document).off('touchstart ' + MSPointer.down);
$(document).off('touchmove ' + MSPointer.move);
}
}
function getMSPointer() {
var pointer;
if (window.PointerEvent) {
pointer = {
down: "pointerdown",
move: "pointermove"
};
} else {
pointer = {
down: "MSPointerDown",
move: "MSPointerMove"
};
}
return pointer;
}
function getEventsPage(e) {
var events = new Array();
if (window.navigator.msPointerEnabled) {
events['y'] = e.pageY;
events['x'] = e.pageX;
} else {
events['y'] = e.touches[0].pageY;
events['x'] = e.touches[0].pageX;
}
return events;
}
function silentLandscapeScroll(activeSlide) {
var prevScrollingSpeepd = options.scrollingSpeed;
$.fn.fullpage.setScrollingSpeed(0);
landscapeScroll(activeSlide.closest('.fp-slides'), activeSlide);
$.fn.fullpage.setScrollingSpeed(prevScrollingSpeepd);
}
function silentScroll(top) {
if (options.css3) {
var translate3d = 'translate3d(0px, -' + top + 'px, 0px)';
transformContainer(translate3d, false);
} else {
container.css("top", -top);
}
}
function getTransforms(translate3d) {
return {
'-webkit-transform': translate3d,
'-moz-transform': translate3d,
'-ms-transform': translate3d,
'transform': translate3d
};
}
$.fn.fullpage.destroy = function(all) {
$.fn.fullpage.setAutoScrolling(false);
$.fn.fullpage.setAllowScrolling(false);
$.fn.fullpage.setKeyboardScrolling(false);
$(window).off('scroll', scrollHandler).off('hashchange', hashChangeHandler).off('resize', resizeHandler);
$(document).off('click', '#fp-nav a').off('mouseenter', '#fp-nav li').off('mouseleave', '#fp-nav li').off('click', '.fp-slidesNav a').off('mouseover', options.normalScrollElements).off('mouseout', options.normalScrollElements);
$('.fp-section').off('click', '.fp-controlArrow').off('click', '.toSlide');
if (all) {
destroyStructure();
}
};
function destroyStructure() {
silentScroll(0);
$('#fp-nav, .fp-slidesNav, .fp-controlArrow').remove();
$('.fp-section').css({
//'height': '',
'background-color': '',
'padding': ''
});
//WILLEM; van niet slides height resetten
$('.content-normal').css({'height': ''});
$('.fp-slide').css({
'width': ''
});
container.css({
//'height': '',
'position': '',
'-ms-touch-action': '',
'touch-action': ''
});
$('.fp-section, .fp-slide').each(function() {
removeSlimScroll($(this));
$(this).removeClass('fp-table active');
})
container.find('.fp-easing').removeClass('fp-easing');
container.find('.fp-tableCell, .fp-slidesContainer, .fp-slides').each(function() {
$(this).replaceWith(this.childNodes);
});
//$('html, body').scrollTop(0);
container.addClass('fullpage-used');
};
function playVideo(currentSection) {
var hasVideo = currentSection.find('video');
if ($(hasVideo).length && !Modernizr.touch) {
hasVideo.get(0).play();
}
};
function pauseAllVideos(section) {
$(section).each(function() {
var hasVideo = $(this).find('video');
if ($(hasVideo).length) {
hasVideo.get(0).pause();
}
});
}
};
})(jQuery);