fix(mobile/shop): Tries to improvie menu show/hide while scrolling

pull/49/head
sovanna 2020-01-21 12:02:38 +01:00
parent d08bfbdcc0
commit 72ce996c37
2 changed files with 14 additions and 4 deletions

View File

@ -219,15 +219,15 @@
mywindow.scroll(function () {
newscroll = mywindow.scrollTop();
if (!navbarSupportedContent.hasClass('show')) {
if (newscroll > (mypos + 30) && !up) {
if (newscroll > (mypos + 0) && !up) {
$('.container-header').stop().fadeOut();
up = !up;
} else if(newscroll < (mypos + 30) && up) {
} else if(newscroll < (mypos + 0) && up) {
$('.container-header').stop().fadeIn();
up = !up;
}
}
// mypos = newscroll;
mypos = newscroll;
});
})();
</script>

View File

@ -27,7 +27,17 @@
(function () {
function deviceIsMobile() {
// https://coderwall.com/p/i817wa/one-line-function-to-detect-mobile-devices-with-javascript
return (typeof window.orientation !== 'undefined') || (navigator.userAgent.indexOf('IEMobile') !== -1);
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)
);
};
window.deviceIsMobile = deviceIsMobile;