gpt4 book ai didi

javascript - 使用 Twitter Bootstrap 在悬停时放大图像

转载 作者:行者123 更新时间:2023-11-30 13:02:58 27 4
gpt4 key购买 nike

我是 bootstrap 的新手,想在悬停时放大所有带有 img-rounded 类的图像

我是这样实现的:

<div class="container">
<div class="row">
<div class="span4">
<div class="well">
<img src="MyImage.png" class="img-rounded">
</div>
</div>
</div>
</div>

<script>
$( document ).ready(function() {
$('.img-rounded').popover({
html: true,
trigger: 'hover',
placement: 'bottom',
content: function () {
return
'<img class="img-rounded" style="float:right;width:500px;max-width:500px;" src="
+$(this)[0].src + '" />';
}
});
});

</script>

不幸的是,放大图像周围的边界框没有放大。如何解决这个问题?

最佳答案

这是由弹出框默认 max-width: 276px 引起的。只需添加

<style type="text/css">
.popover {
max-width: 1000px;
}
</style>

(或任何其他值,auto 在这里不起作用)并且弹出框将适合图像。

关于javascript - 使用 Twitter Bootstrap 在悬停时放大图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16716258/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com