From 72ce996c378b2dd9c4ac5eb1382010f3d3790c47 Mon Sep 17 00:00:00 2001 From: sovanna Date: Tue, 21 Jan 2020 12:02:38 +0100 Subject: [PATCH] fix(mobile/shop): Tries to improvie menu show/hide while scrolling --- templates/_base.html | 6 +++--- templates/page-place-order.html | 12 +++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/templates/_base.html b/templates/_base.html index 36ba8d1..bddd781 100644 --- a/templates/_base.html +++ b/templates/_base.html @@ -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; }); })(); diff --git a/templates/page-place-order.html b/templates/page-place-order.html index 7ba193c..42a22b7 100644 --- a/templates/page-place-order.html +++ b/templates/page-place-order.html @@ -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;