javascript - 避免出现 Bootstrap 灯箱滚动条
问题描述
我正在使用 Ashley White 的Bootstrap Lightbox代码。
$(document).on('click', '[data-toggle="lightbox"]', function(event) {
event.preventDefault();
$(this).ekkoLightbox();
});
<!-- css -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css" rel="stylesheet">
<!-- HTML -->
<a href="https://i.scdn.co/image/ab67616d0000b273528034c2cfe590178ac6657a" data-toggle="lightbox" data-title="Instrument Soundtrack by Fugazi">
<img src="https://unsplash.it/250.jpg?image=250" class="img-fluid">
</a>
<!-- javascript -->
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.min.js"></script>
出于某种原因,当我单击较小的图像打开灯箱图像时,模态窗口包含滚动条。
我已经查看了文档,并且还测试了通过data-max-width="250"
例如设置最大值,但这样做仍然会导致滚动条可见。
我想知道是否有一种方法可以在不出现滚动条的情况下使图像适合?
解决方案
推荐阅读
- javascript - 正文标记中的 HTML 单选按钮,一旦选择获取该行的所有值并调用 RPGLE 程序
- unity3d - Unity - 构建设置窗口运行缓慢
- azure-application-insights - 使用 KQL (Kusto) 选择行时遇到问题
- javascript - --Expected token ':'-- 在我的 VS Code 中,但是 --Uncaught SyntaxError: Unexpected token 'return'-- 在我的浏览器上
- reactjs - 对应该是 props 和 state 的纯函数的渲染方法的警告
- kubernetes - 无法通过 kubectl 代理打开服务
- android - Delphi Firemonkey - 为 Android 中的通知通道分配自定义警报
- amazon-web-services - 使用 AWS 的 ssl 证书后,我收到 [Your connection is not private]
- regex - 正则表达式从路径中排除某些字符串
- java - 在哪里放置@Cacheable注解