fix(menu/scroll): Allows effect only on mobile
This commit is contained in:
parent
0191350c48
commit
5f42340b04
|
@ -210,12 +210,32 @@
|
|||
</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) {
|
||||
|
|
Loading…
Reference in New Issue