File: D:/HostingSpaces/SBogers10/straffer.komma.nl/wwwroot/js/main.js
/**
* Created by Pascal on 30/09/15.
*/
$(function() {
resizer();
$( window ).resize(function() {
resizer();
});
$( window).scroll(function(){
scroller();
});
$('svg.arrows').click(function(){
$("html, body").animate({ scrollTop: ($("svg.arrows").offset().top + 65) }, 1000);
});
});
function resizer(){
if($('.header-image')){
//$('.header-image img').height($( window ).height() - 100);
}
}
var buggy = false;
function scroller(){
if($(window).scrollTop()<= 10 ){
$('.scrolled').removeClass('scrolled');
}
else{
$('header').addClass('scrolled');
$('.header-image').addClass('scrolled');
}
if(($('.sticky-previous-next').length > 0)) {
if ($(window).scrollTop() + $(window).height() <= ($(document).height() - 370)) {
$('.sticky-previous-next').removeClass('hide');
}
else{
$('.sticky-previous-next').addClass('hide');
}
}
}
function isElementFullInViewport(el) {
//special bonus for those using jQuery
if(el.length > 0){
if (typeof jQuery === "function" && el instanceof jQuery) {
el = el[0];
}
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
rect.bottom <= (window.innerHeight || $(window).height())
);
}
}
function isElementPartInViewport(el)
{
if(el.length > 0) {
//special bonus for those using jQuery
if (typeof jQuery !== 'undefined' && el instanceof jQuery) el = el[0];
var rect = el.getBoundingClientRect();
// DOMRect { x: 8, y: 8, width: 100, height: 100, top: 8, right: 108, bottom: 108, left: 8 }
var windowHeight = (window.innerHeight || document.documentElement.clientHeight);
var windowWidth = (window.innerWidth || document.documentElement.clientWidth);
var vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);
var horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);
return (vertInView && horInView);
}
}
function isElementPartExtraInViewport(el, margin)
{
if(el.length > 0) {
//special bonus for those using jQuery
if (typeof jQuery !== 'undefined' && el instanceof jQuery) el = el[0];
var rect = el.getBoundingClientRect();
// DOMRect { x: 8, y: 8, width: 100, height: 100, top: 8, right: 108, bottom: 108, left: 8 }
var windowHeight = (window.innerHeight || document.documentElement.clientHeight);
var windowWidth = (window.innerWidth || document.documentElement.clientWidth);
var vertInView = (rect.top <= (windowHeight - margin)) && ((rect.top + rect.height) >= 0);
var horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);
return (vertInView && horInView);
}
}