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
pull/201/head
Spirit 2020-03-20 11:02:52 +08:00
parent 2e5b6ac6a0
commit 499d2c324e
3 changed files with 7 additions and 16 deletions

View File

@ -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(

View File

@ -73,6 +73,7 @@ mashiro_option.float_player_on = true;
mashiro_option.cover_api = "<?php echo rest_url('sakura/v1/image/cover'); ?>";
mashiro_option.windowheight = /Mobile|Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent) ? 'fixed' : 'auto';
/*End of Initial Variables*/
</script>
<?php }

View File

@ -1334,25 +1334,15 @@ var home = location.href,
});
},
AH: function () {
if (Poi.windowheight == 'auto') {
if (Poi.windowheight == 'auto' && mashiro_option.windowheight == 'auto') {
if ($('h1.main-title').length > 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');