jQuery(document).ready(function($){ function getHeight() { var myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myHeight = window.innerHeight; } else if( document.documentElement && document.documentElement.clientHeight ) { //IE 6+ in 'standards compliant mode' myHeight = document.documentElement.clientHeight; } else if( document.body && document.body.clientHeight ) { //IE 4 compatible myHeight = document.body.clientHeight; } return [ myHeight ]; } function gotoAnker() { //!important: setTimeout niet verwijderen setTimeout("window.location.hash = encodeURIComponent(window.location.hash.substr(1));",500); setTimeout("window.location.replace(decodeURIComponent(window.location.hash));",500); if (window.location.hash.indexOf('[') == -1) animateAnker(20); else animateAnker(5); } function animateAnker(y) { setTimeout(function() { $('html,body').animate({scrollTop: $(window).scrollTop()-y}, 500, function() { }); },600); } function gotohash(e) { ankerinData = 0; ankerinBody = 0; var targ; if(!e) var e = window.event; if (e.target) targ = e.target; else if (e.srcElement) targ = e.srcElement; if (targ.nodeType == 3) // defeat Safari bug targ = targ.parentNode; if (typeof targ.href === 'undefined') //kan tag binnen staan { targ = targ.parentNode; } if (typeof targ.href === 'undefined') { return; } else { if (targ.hash) { if (isArticle == 1) { articleAnker = targ.hash; //los anker if (targ.href.indexOf('article-') > -1 ) { var url = targ.href.replace(/\-*article\-.*/, ""); url = url + articleAnker; } else { //volledige URL var url = targ.href; } window.location.href = url; return false; } ververs = targ.href; // check if external link if (ververs.indexOf(window.location.host) == -1) { window.location = ververs; } else { if ( 0 || ververs.indexOf('home/8#') > 0 || ververs.indexOf('page_id=8#') > 0 || ververs.indexOf('home/8?') > 0 || ververs.indexOf('page_id=8?') > 0) //andere page id { location.replace(ververs); anker = 'name="' + window.location.hash.substr(1) + '"'; //anker zonder # ankerh = 'name="' + window.location.hash + '"'; //anker met # ankerID = 'id="' + window.location.hash.substr(1); if (anker && (document.body.innerHTML.indexOf(anker) > -1 || document.body.innerHTML.indexOf(ankerh) > -1 || document.body.innerHTML.indexOf(ankerID) > -1) && window.location.hash) { ankerinBody = 1; gotoAnker(); return false; } ID=$(".select_container:last").attr("id").replace("m",""); last_para_function(ID); } else { window.location = ververs; // location.reload(); werkt niet in IE } } } else { } } }; function last_para_function(fromID) { if(fromID != postedID) { $('div#last_para_order').fadeIn(400); $.post("?getnext="+ID+"&page_id=8", function(data){ if (data != "") { $(".select_container:last").after(data); } //als anker in data gevonden is extra textblok if (anker && (data.indexOf(anker) > -1 || data.indexOf(ankerh) > -1 || data.indexOf(ankerID) > -1)) { ankerinData = 1; postedID = fromID; ID=$(".select_container:last").attr("id").replace("m",""); last_para_function(ID); ankerinBody = 1; gotoAnker(); } //als er een anker is en deze nog niet in data gevconden if (anker && (data.indexOf(anker) == -1 || data.indexOf(ankerh) == -1 || data.indexOf(ankerID) == -1) && ankerinBody == 0 && ankerinData == 0) { postedID = fromID; ID=$(".select_container:last").attr("id").replace("m",""); last_para_function(ID); } jQuery('[data-parallax="scroll"]').parallax(); jQuery(window).trigger('load.px.parallax'); //console.log('trigger'); }); postedID = fromID; setTimeout("jQuery('div#last_para_order').fadeOut(400);",1000); if (typeof addthis != 'undefined') { addthis.toolbox('.addthis_toolbox'); } } }; if ( typeof $(".select_container:last").attr("id") != 'undefined' ) { var ID=$(".select_container:last").attr("id").replace("m",""); var postedID; if (window.location.href.indexOf('article-') > -1) var isArticle = 1; else var isArticle = 0; if (window.location.hash) { var anker = 'name="' + window.location.hash.substr(1); var ankerh = 'name="' + window.location.hash; var ankerID = 'id="' + window.location.hash.substr(1); } else { var anker = false; var ankerh = false; } var ankerinBody = 0; var ankerinData = 0; //bestaat anker in huidige first loaded pag if (anker && (document.body.innerHTML.indexOf(anker) > -1 || document.body.innerHTML.indexOf(ankerh) > -1 || document.body.innerHTML.indexOf(ankerID) > -1) && window.location.hash) { ankerinBody = 1; } //laad social media if (typeof addthis != 'undefined') { addthis.toolbox('.addthis_toolbox'); } document.onclick = gotohash; //check for anchor on doc load if (window.location.hash && isArticle == 0) { last_para_function(ID); } $(window).scroll(function(){ if ($(window).scrollTop()+1000 >= document.getElementById('body_container').offsetHeight - getHeight() && isArticle == 0) { ID=$(".select_container:last").attr("id").replace("m",""); last_para_function(ID); } }); } $(".WinKnop").click(function(event) { if (event.target.href == document.URL) { event.preventDefault(); } }); });