Last active
February 20, 2021 14:50
-
-
Save ManotLuijiu/41c0f99f6e3a9abd80fb3e9a8b2d1c11 to your computer and use it in GitHub Desktop.
WordPress Script for take care social icons toggle hide/show using Elementor & Essential Addons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.onscroll = function () { | |
var e = window, | |
a = 'inner'; | |
var viewportWidth; | |
var viewportHeight; | |
if (!('innerWidth' in window)) { | |
a = 'client'; | |
e = document.documentElement || document.body; | |
} | |
viewportWidth = { width: e[a + 'Width'] }; | |
vw = JSON.stringify(viewportWidth.width); | |
viewportHeight = { height: e[a + 'Height'] }; | |
vh = JSON.stringify(viewportHeight.height); | |
document.getElementById('means__viewport__check').innerHTML = | |
'<div class="elementor-column-wrap elementor-element-populated"><div class="elementor-widget-wrap">\ | |
<div class="elementor-element elementor-align-right elementor-widget elementor-widget-breadcrumbs">\ | |
<div class="elementor-widget-container"><p id="means__viewport__p">\ | |
<span class="breadcrumb_last" style="color: #808285">มิติของหน้าจอ(กว้าง x สูง)</span>\ | |
<span style="color: #e33371">' + | |
' ' + | |
vw + | |
'x' + | |
vh + | |
' px</span></p></div></div></div></div>'; | |
// handle social icons at footer | |
if ( | |
document.getElementById('means__social__th') && | |
document.getElementById('means__social__icons__upper') | |
) { | |
if ( | |
window.innerHeight + window.scrollY + 2000 > document.body.clientHeight && | |
vw <= 2200 | |
) { | |
document.getElementById('means__social__th').style.display = 'none'; | |
document.getElementById('means__social__icons__upper').style.display = | |
'block'; | |
} else if ( | |
window.innerHeight + window.scrollY + 2000 > document.body.clientHeight && | |
vw > 2200 | |
) { | |
document.getElementById('means__social__th').style.display = 'none'; | |
document.getElementById('means__social__icons__upper').style.display = | |
'none'; | |
} else if ( | |
window.innerHeight + window.scrollY + 2000 < document.body.clientHeight && | |
vw <= 2200 | |
) { | |
document.getElementById('means__social__th').style.display = 'none'; | |
document.getElementById('means__social__icons__upper').style.display = | |
'block'; | |
} else { | |
document.getElementById('means__social__th').style.display = 'block'; | |
document.getElementById('means__social__icons__upper').style.display = | |
'none'; | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment