【发布时间】:2017-03-20 10:40:51
【问题描述】:
我希望有人可以为这个问题提供解决方案。我的情况是我有一个具有引导弹出效果的链接,每次将鼠标悬停在它上面时,它都会显示一个图像。但问题是,当您第一次将鼠标悬停在链接上时,popover 容器总是偏移。我的代码:
我自己的代码是这样的:
<a href="{% url 'consilium:detail' movie.slug %}" class="thumbnail title-link" {% if movie.image %} data-toggle="popover" data-placement="left" data-full="{{movie.image.url}}" {% endif %}>
<span class="flex-input">
<input class="get-title" value="{{ movie.title }}" form="movie{{ forloop.counter }}" name="title" readonly/>
</span>
</a>
body .popover {
max-width: 240px;
}
.hover-image {
width: 180px;
}
-
$(document).ready(function() {
$('[data-toggle="popover"]').popover({
container: 'body',
html: true,
placement: 'left',
trigger: 'hover',
content: function() {
var url = $(this).data('full');
return '<img class="hover-image" src="' + url + '">'
}
});
});
这是一个活生生的例子:
有人知道怎么解决吗?
【问题讨论】:
标签: javascript html css bootstrap-popover