script-seedit.js
2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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);
});