隐藏a< div>当用JavaScript滚动到底部时
几分钟前,我签署了我的问题,向您询问亲爱的社区。
不幸的是,我已经试图取得类似的问题,没有成功。
JavaScript不是我的强项,
如果它是一种移动设备,可以向他们显示这样的移动导航栏,那么我正在使用PHP检测到。 导航栏位于底部(并隐藏我的版权文本)。
if(isMobileDevice()){
require __DIR__. '/mobile-navbar.php';
}
我的移动 - navbar.php看起来如此
<div class="uver-mobile-navbar" id="mobile-navbar">
<a href="#uver" class="active">uver</a>
<a href="#uver">uver</a>
<a href="#uver">uver</a>
<a href="#uver">uver</a>
<a href="#uver">uver</a>
</div>
,我的移动 - navbar.js看起来很问题,
document.onscroll = function() {
if (window.innerHeight + window.scrollY > document.body.clientHeight) {
document.getElementById('mobile-navbar').style.display='none';
}else{
document.getElementById('mobile-navbar').style.display='block';
}
}
问题是,一旦我滚动,div就会消失。 当我滚动时,它不再出现了。
我提前感谢您的支持。
此致 里凡
I signed up a few minutes ago to ask my question to you dear community.
I have already tried to get ahead with similar questions, unfortunately without success.
Javascript is not my forte
I am detecting with php if it is a Mobile Device to show them a mobile navigationbar like this.
The navigation bar is positioned at the bottom (and hides my Copyright Text).
if(isMobileDevice()){
require __DIR__. '/mobile-navbar.php';
}
my mobile-navbar.php looks so
<div class="uver-mobile-navbar" id="mobile-navbar">
<a href="#uver" class="active">uver</a>
<a href="#uver">uver</a>
<a href="#uver">uver</a>
<a href="#uver">uver</a>
<a href="#uver">uver</a>
</div>
and my mobile-navbar.js looks so
document.onscroll = function() {
if (window.innerHeight + window.scrollY > document.body.clientHeight) {
document.getElementById('mobile-navbar').style.display='none';
}else{
document.getElementById('mobile-navbar').style.display='block';
}
}
The problem is that as soon as I scroll, the div disappears.
When I scroll up it doesn't appear anymore.
I thank you in advance for your support.
Best Regards
Ridvan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论