script-seedit.js 2.69 KB
jQuery(document).ready( function() {


    function scrollScripts() {
  
      if(!jQuery('#content-wrap').hasClass('retract')) {
        if(jQuery(window).scrollTop() >= 150) {
            jQuery('#content-wrap').addClass('retract');
            jQuery('#page-header-seedit').addClass('retract');
            jQuery('#mySidenav').addClass('retract');
            jQuery('#page-header-part').addClass('retract');
            jQuery('#myTopnav').css('top', '40px');
            jQuery('#menu-seedit-main').css('margin-top', '15px');
           
            
            jQuery('.tag-line').hide();
  
            document.querySelector(".otherpage-logo").getSVGDocument().getElementById("Community_Nutrition_Resources_Food_Security").setAttribute("fill-opacity", "0");
            
        }
      } else {
          if(jQuery(window).scrollTop() < 170) {
              jQuery('#content-wrap').removeClass('retract');
              jQuery('#page-header-seedit').removeClass('retract');
              jQuery('#mySidenav').removeClass('retract');
              jQuery('#page-header-part').removeClass('retract');
              jQuery('#menu-seedit-main').css('margin-top', '50px');
              jQuery('.tag-line').show();
              jQuery('#myTopnav').css('top', '100px');
              document.querySelector(".otherpage-logo").getSVGDocument().getElementById("Community_Nutrition_Resources_Food_Security").setAttribute("fill-opacity", "1");
            
          }
      }
    }

    jQuery(document).on("click","#menu-seedit-main li a",function(evt) {
          jQuery('#mySidenav').removeClass('mobile-open');
      });
      
      document.addEventListener('dblclick', (event) => {
        event.preventDefault()
    }, { passive: false });
    
    var scrolling = false;
   
    jQuery( window ).scroll( function() {
        scrolling = true;
    });
  
    jQuery('#side-window').scroll(function() {
        scrolling = true;
    });
    
    setInterval( function() {
        if ( scrolling ) {
            scrolling = false;
            scrollScripts();
        }
    }, 250 );
    
    // or for modern browsers
    document.addEventListener( 'wheel', function( evt ) {
        scrolling = true;
    }, { capture: false, passive: true });
  
    scrollScripts();

    var el = document.getElementById('commonwell-link');
var style = window.getComputedStyle(el, null).getPropertyValue('font-size');
var fontSize = style;
var fontSizePercentage = parseFloat(style) / 12 * 100;
if( fontSizePercentage > 100){
  document.body.className += ' large_font';
 // $('.menu-item-220  a').attr('href','/news/');
}
if( fontSizePercentage > 125){
    document.body.className += ' xlarge_font';
  }

console.log(style, fontSizePercentage);

  });