我有
<img class="arrow_down" src="arrow_down.png" alt="scroll down" style="max-width: 5%; height: auto;">
Run Code Online (Sandbox Code Playgroud)
现在,我希望该图像可见,直到我向下滚动网页,所以从第一个滚动它将被隐藏.我在java脚本或jQuery中编码,如下所示:
jQuery(function($, undefined) {
if ($("body").scrollTop() = 0 || $("html").scrollTop() = 0) {
$(".arrow_down").fadeIn(400);
}
else {
$(".arrow_down").hide();
}
};
Run Code Online (Sandbox Code Playgroud)
这不行,请帮帮我...
我有一个严重的问题.我还没有找到解决方案,所以我希望你知道.
我在做网站.我需要制作响应式封面背景图片.(涵盖整页).我开始时:
/* Location of the image */
background-image: url(main.jpg);
/* Background image is centered vertically and horizontally at all times */
background-position: center center;
/* Background image doesn't tile */
background-repeat: no-repeat;
/* Background image is fixed in the viewport so that it doesn't move when
the content's height is greater than the image's height */
background-attachment: fixed;
/* This is what makes the background image rescale based
on the container's size */
background-size: cover;
/* Set a background …Run Code Online (Sandbox Code Playgroud) 我的 iOS Safari 下拉菜单设置存在严重问题。想象一个网站,顶部有一个标题。如果你点击标题,它就会向下滑动,就像手机上的任何通知中心一样。我选择的方式很简单。我有一个<div class="settings hide">这样的CSS:
.settings{
position: fixed;
width: 100%;
height: calc(100vh + 60px);
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
z-index: 10;
}
.hide{
top: -100vh;
}
Run Code Online (Sandbox Code Playgroud)
现在,这使得它看起来像这样:
现在,下一步是创建它“可滑动”,这是我使用 jQuery 通过添加名为“show”的类来完成的。
.show{
top: calc(0vh - 60px);
}
Run Code Online (Sandbox Code Playgroud)
这实际上让它变得很棒。它刚刚起作用了!突然我在 iPhone 上尝试了这个网站,由于底部栏一直显示,直到你滚动,我的臀部都消失了。
因为它看起来像这样:
到目前为止得到了吗?我的菜单确实滑动正确,在任何浏览器中看起来都很棒,但在 Safari 中,它隐藏在栏后面,所以用户实际上无法关闭它。
我尽了最大努力来解决这个问题,但没有任何事情真正如我所愿。
PS:我假设你知道这一点,但是当你使用 时它会起作用bottom: 0;,然后它“知道”该栏并正确地停止在它的正上方。但因为设置是根据top位置计算的,所以它does not会执行动画,这对我的设计来说是必需的。
任何帮助/解决方案表示赞赏!