如题
图片如下:
这个应该怎么解决?基于vue-cli的项目
时隔10天了...
思路是高度发生变化时候,隐藏掉该导航栏
footerbox ==> 底部导航
$(function(){
var mHeight = $(document).height();
$(window).resize(function () {
if($(document).height() < mHeight){
$("#footerbox").css({"position":"static","display":"none"});
}else{
$("#footerbox").css({"position":"absolute","display":"block"});
}
});
});
希望有用...
各路大神显神通,正好我最近遇到了这个问题footer使用fixed布局,在部分安卓机型会出现这种情况,我监听了用户输input的状态,输入的时候让footer的position为static,在光标离开input的时候再设置回fixed。
<template>
<!-其他代码省略-->
<input class="search" @focus="focus" @blur="blur"/>
<footer id='footers'></footer>
</template>
<script>
<!-其他代码省略-->
methods:{
focus(e){
//考虑到footer不一定和input在一个组件内,所以没有使用vue的$refs
var footer=document.getElementById('footers')
footer.style.position='static'
},
blur (e) {
var footer=document.getElementById('footers')
footer.style.position='fixed'
}
}
</script>
使用 scrollIntoView API 保证当前的元素显示在窗口
<body>
<div class="chunk"></div>
<div class="btn-top">up</div>
<div class="btn-bottom">down</div>
<script>
const up = document.querySelector('.btn-top');
const down = document.querySelector('.btn-bottom');
const test = document.querySelector('.chunk');
up.addEventListener('click', function() {
test.scrollIntoView(true);
});
down.addEventListener('click', function() {
test.scrollIntoView(false);
});
</script>
</body>
5 回答1.3k 阅读
9 回答1.5k 阅读✓ 已解决
3 回答1.3k 阅读✓ 已解决
5 回答2.2k 阅读
2 回答781 阅读✓ 已解决
6 回答661 阅读
2 回答1.8k 阅读
正常就该顶上去啊。你加个背景就行了。
然后我看了其他几个网站的解决方案: