javascript - 当下载栏出现在底部时,页面上的幻灯片内容会跳起来
问题描述
每当下载栏出现在底部时,主页上的幻灯片内容就会跳起来。一旦我关闭下载栏,它就会回到正常位置。https://photos.app.goo.gl/F482eMfkXyfEZkdA9。
我猜它与CSS有关。希望有人可以提供帮助。抱歉,如果之前有人问过类似的问题,但我看了看,找不到任何东西,而且我对这个领域还很陌生。
这是CSS代码:
#slideshow > div {
width: 970px;
height: 500px;
display: block;
float: left;
position: absolute;
bottom: -5px;
right: auto;
background-repeat: no-repeat;
margin-left: 20px;
line-height: 180px;
}
JavaScript:
$("#slideshow > div:gt(0)").hide();
setInterval(function() {
$('#slideshow > div:first')
.fadeOut(1000)
.next()
.fadeIn(1000)
.end()
.appendTo('#slideshow');
}, 5000);
解决方案
而不是将元素对齐到bottom: -5px;
使用top
对齐来避免这种行为。
#slideshow > div
{
width: 970px;
height: 500px;
display: block;
float: left;
position: absolute;
top: 150px; /* <- change this */
right: auto;
background-repeat: no-repeat;
margin-left: 20px;
line-height: 180px;
}
推荐阅读
- debugging - 如何在 IntelliJ 中调试在 Kubernetes pod 中运行的 Kotlin 应用程序?
- r - 在 R 中运行“devtools::build_vignettes()”时如何修复“系统命令错误”?
- php - 如何在 Laravel 5.8 中使用 IF 和 ELSE 检查 mysql 表 NULL 或 NOT?
- python - 为什么输出顺序是原样 - 我认为它必须是其他的?
- compiler-errors - 有人在 Jetson TX2 上编译过 Tensorflow_federated 吗?
- python - 无法在烧瓶应用程序中使用 os.system 命令从 Docker 获取输出
- java - Java中的ArrayList多态性
- php - 使用用户名/密码远程配置 PHP Xdebug?
- ios - 使用 PageViewController 上的下一步按钮
- javascript - 通过 node.js 访问 MusicKit API 时出现 401 错误