forked from M-Labs/web2019
fix(mobile/menu): Removes topnav effect
This commit is contained in:
parent
58214dc179
commit
2002f4b913
|
@ -212,53 +212,6 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function deviceIsMobile() {
|
||||
// https://coderwall.com/p/i817wa/one-line-function-to-detect-mobile-devices-with-javascript
|
||||
return (
|
||||
(typeof window.orientation !== 'undefined') ||
|
||||
navigator.userAgent.match(/Android/i) ||
|
||||
navigator.userAgent.match(/webOS/i) ||
|
||||
navigator.userAgent.match(/iPhone/i) ||
|
||||
navigator.userAgent.match(/iPad/i) ||
|
||||
navigator.userAgent.match(/iPod/i) ||
|
||||
navigator.userAgent.match(/BlackBerry/i) ||
|
||||
navigator.userAgent.match(/Windows Phone/i) ||
|
||||
(navigator.userAgent.indexOf('IEMobile') !== -1)
|
||||
);
|
||||
};
|
||||
|
||||
(function () {
|
||||
var mywindow = $(window);
|
||||
var mypos = mywindow.scrollTop();
|
||||
var up = false;
|
||||
var newscroll;
|
||||
var navbarSupportedContent = $('#navbarSupportedContent');
|
||||
|
||||
if (!deviceIsMobile()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mywindow.scroll(function () {
|
||||
newscroll = mywindow.scrollTop();
|
||||
if (newscroll < 30) {
|
||||
$('.container-header').stop().fadeIn();
|
||||
return;
|
||||
}
|
||||
if (!navbarSupportedContent.hasClass('show')) {
|
||||
if (newscroll > (mypos + 0) && !up) {
|
||||
$('.container-header').stop().fadeOut();
|
||||
up = !up;
|
||||
} else if(newscroll < (mypos + 0) && up) {
|
||||
$('.container-header').stop().fadeIn();
|
||||
up = !up;
|
||||
}
|
||||
}
|
||||
mypos = newscroll;
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
{% block js %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue