var infoContainer = $('.divBlogViewLeftContainer'); var socialButtons = $('.scl-float-buttons'); var socialShowing = false; $(window).load(function() { LoadSocialShares(); processHeightAdjust('fix-for-sticky'); /* FULL WIDTH BUG FIX ================== When scrolling too fast, the width of the blog item uses the windows width instead of the parent element. This is due to sticky.js overriding using inline styles. So we use the MutationObserver to detect when the element style changes, and when it does just remove the inline style of the element. Please ensure that if you want to mofify .try-us-final-sidebar then please do so in the CSS file instead of in-line as it will be removed */ // Create an observer var oObserver = new MutationObserver( function() { // When the callback is called, remove the style attribute $(".try-us-final-sidebar").removeAttr("style"); // Stop observing oObserver.disconnect(); }); // Observe the element with the bug oObserver.observe( $(".try-us-final-sidebar")[0], { attributes : true, attributeFilter : ['style'] }); }); function LoadSocialShares(){ socialButtons.css("top",infoContainer.offset().top+8); } function CheckIfShowSocial(){ if(!socialShowing){ if($(window).scrollTop() > 0 && footerScrollCheck()){ socialButtons.css("opacity","1"); socialShowing = true; } } else { if($(window).scrollTop() == 0 || !footerScrollCheck()){ socialButtons.css("opacity","0"); socialShowing = false; } } } function footerScrollCheck(){ // if($(window).width > 750){ // windowHeight = $(window).height(); // footerPosition = $('.footer-social-icons').offset().top; // //footerPosition = document.height - 50; // if (($(window).scrollTop() + windowHeight) > footerPosition){ // return false; // } else { // return true; // } // } else { // // windowHeight = $(window).height(); // // footerPosition = $('.footer-social-icons').offset().top; // // //footerPosition = document.height - 50; // // if (($(window).scrollTop() + windowHeight) > footerPosition){ // // return false; // // } else { // return true; // //} // } return true; } window.addEventListener("optimizedScroll", function() { CheckIfShowSocial(); }); window.addEventListener("optimizedResize", function() { if(window.innerWidth > 991){ processHeightAdjust('fix-for-sticky'); } }); /* #fb-shares #tw-shares #in-shares */ ;(function() { //declared throttle function var throttle = function(type, name, obj) { //if obj attribute is not defined then make it equal to window obj = obj || window; var running = false; //new function var func = function() { //if its firing retun if (running) { return; } running = true; //limit turn off using request animation frame requestAnimationFrame(function() { //trigger the custom event obj.dispatchEvent(new CustomEvent(name)); running = false; }); }; obj.addEventListener(type, func); }; //comment out either of these if you dont need them throttle ("scroll", "optimizedScroll"); throttle("resize", "optimizedResize"); })(); var processHeightJsNodes = []; function processHeightAdjust() { var processHeightJsNodes = processHeightJsNodes || []; if(! processHeightJsNodes[0]){ for (i = 0; i < arguments.length; i++) { processHeightJsNodes.push(document.getElementsByClassName(arguments[i])); } } for (i = 0; i < processHeightJsNodes.length; i++) { var max = 0; var elements = []; elements = processHeightJsNodes[i]; for (x = 0; x < elements.length; x++) { elements[x].style.setProperty("height","auto"); //elements[x].removeAttribute("style"); if(elements[x].clientHeight > max) max=Math.ceil(elements[x].clientHeight); } for (y = 0; y < elements.length; y++) { elements[y].style.setProperty("height",max+"px"); } } } /* make sure links in the blog article open in a new window */ $(function(){ $('.HTMLPageContent').find('a').each(function(){ $(this).attr({ target : "_blank", rel : "noopener noreferrer" }); }); }); /* if the link has a class of "selflink" then apply _self instead of _blank */ $(function(){ $('.HTMLPageContent').find('#selflink').each(function(){ $(this).attr({ target : "_self", rel : "noopener noreferrer" }); }); });