From 499d2c324e907590cd14b1b9ec33121bc2201799 Mon Sep 17 00:00:00 2001 From: Spirit Date: Fri, 20 Mar 2020 11:02:52 +0800 Subject: [PATCH] refactor: first screen the Above The Fold of mobile not depend wp_is_mobile anymore, and window height is set `vh` to fit issue-199 --- functions.php | 6 +++--- inc/swicher.php | 1 + js/sakura-app.js | 16 +++------------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/functions.php b/functions.php index 1e9dd90..450e8ec 100644 --- a/functions.php +++ b/functions.php @@ -199,9 +199,9 @@ function sakura_scripts() $movies = akina_option('focus_amv') ? array('url' => akina_option('amv_url'), 'name' => akina_option('amv_title'), 'live' => $mv_live) : 'close'; $auto_height = akina_option('focus_height') ? 'fixed' : 'auto'; $code_lamp = 'close'; - if (wp_is_mobile()) { - $auto_height = 'fixed'; - } + // if (wp_is_mobile()) { + // $auto_height = 'fixed'; + // } //拦截移动端 version_compare($GLOBALS['wp_version'], '5.1', '>=') ? $reply_link_version = 'new' : $reply_link_version = 'old'; wp_localize_script('app', 'Poi', array( diff --git a/inc/swicher.php b/inc/swicher.php index 7f0ca16..ad8c560 100644 --- a/inc/swicher.php +++ b/inc/swicher.php @@ -73,6 +73,7 @@ mashiro_option.float_player_on = true; mashiro_option.cover_api = ""; +mashiro_option.windowheight = /Mobile|Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent) ? 'fixed' : 'auto'; /*End of Initial Variables*/ 0) { var _height = $(window).height() + "px"; $('#centerbg').css({ - 'height': _height + 'height': '100vh' }); $('#bgvideo').css({ - 'min-height': _height + 'min-height': '100vh' }); - window.resizeFlag = null; - $(window).resize(function () { - //直接resize性能爆炸,改成延时 - if (resizeFlag = null) { - clearTimeout(resizeFlag); - } - resizeFlag = setTimeout(function () { - Siren.AH(); - }, 1000); - }) } } else { $('.headertop').addClass('headertop-bar');