【发布时间】:2017-10-23 09:50:55
【问题描述】:
我在我的一个项目中使用引导弹出框,但遇到了问题。我的弹出框被向上推,因为它碰到了可见屏幕的底部,但是当我向下滚动时,它也不会向下移动以与箭头对齐。
这是现场发生的照片,请看我已经向下滚动,但它并没有随着我向下移动。
编辑:代码
$(document).ready(function(){
$("[data-toggle=popover]").popover({
trigger: 'hover',
html: true
})
});
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<style>
.popover {
border-radius: 0;
border: none;
background: none;
}
.popover.bs-popover-right .arrow::after {
border-right-color: rgba(0, 80, 173, 0.8);
}
.popover.bs-popover-left .arrow::after {
border-left-color: rgba(0, 80, 173, 0.8);
}
.popover.bs-popover-top .arrow::after {
border-top-color: rgba(0, 80, 173, 0.8);
}
.popover.bs-popover-bottom .arrow::after {
border-bottom-color: rgba(0, 80, 173, 0.8);
}
.popover.bs-popover-auto[x-placement^=bottom] .popover-header::before,
.popover.bs-popover-bottom .popover-header::before {
border-bottom: 1px solid rgba(0, 80, 173, 0.8);
}
.popover-header {
padding: 18px 23px;
border-radius: 0;
color: #fff;
background: rgba(0, 80, 173, 0.5);
border-bottom: 1px solid rgba(0, 80, 173, 0.8);
}
.popover-body {
padding: 19px 24px;
border-radius: 0;
color: #eaeaea;
background: rgba(0, 80, 173, 0.5);
}
</style>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-sm-12 col-md-4" style="height: 120vh;">
<img style="width: 45%;" src="https://cdn2.littlethings.com/app/uploads/2017/05/cute-dog-yorkie-600x600.jpg" tabindex="0" role="button" data-toggle="popover" data-placement="left" title="idk" data-content="idk">
<img style="width: 45%;" src="https://cdn2.littlethings.com/app/uploads/2017/05/cute-dog-yorkie-600x600.jpg" tabindex="0" role="button" data-toggle="popover" data-placement="left" title="idk" data-content="idk">
<img style="width: 45%;" src="https://cdn2.littlethings.com/app/uploads/2017/05/cute-dog-yorkie-600x600.jpg" tabindex="0" role="button" data-toggle="popover" data-placement="left" title="idk" data-content="idk">
</div>
</div>
</div>
</body>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>
【问题讨论】:
-
在什么情况下弹出,未对齐请提及状态因为我检查它们工作正常。
-
@HardenRahul 我已经编辑了帖子,因为我发现我的问题不是我想的那样。
-
你的代码在 jsfiddle 或 codepen 中吗?
-
@Sodhisaab 将鼠标悬停在第三张图片上(向下滚动,不要转到整页)
标签: html css twitter-bootstrap bootstrap-popover