我不知道您是否加载了其他技术,但我看到加载的技术来自bootstrapBundle.js
更新
删除所有使图像隐藏的类,hidden-xs hidden-sm
并在页面加载后添加它们。此外,lazy
再次添加类以让bootstrapBundle.js
技术处理它们。
$(document).ready(function () {
// Select your images by class 'deferImage'
var imgDefer = $('.deferImage');
// Loop through them and add classes
for (var i = 0; i < imgDefer.length; i++) {
$(imgDefer[i]).addClass('hidden-xs hidden-sm');
}
});
我已经测试过了,它似乎工作。请按照以下示例进行操作:
例子:
$(document).ready(function() {
// Select your images based on class 'deferImage'
var imgDefer = $('.deferImage');
// Loop through them and add classes
for (var i = 0; i < imgDefer.length; i++) {
$(imgDefer[i]).addClass('hidden-xs hidden-sm');
}
});
img {
width: 100%;
height: auto;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://www.cartridgemonkey.com/bundles/bootstrapBundle.js"></script>
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="item2"><img alt="..." class="popup g-cur-p deferImage lazy" data-original="https://source.unsplash.com/500x500" data-popupname="pwGuide1" data-target="#popup" data-toggle="modal"></div>
</div>
<div class="col-md-4">
<div class="item2"><img alt="..." class="popup g-cur-p deferImage lazy" data-original="https://source.unsplash.com/500x500" data-popupname="pwGuide2" data-target="#popup" data-toggle="modal"></div>
</div>
<div class="col-md-4">
<div class="item2"><img alt="..." class="popup g-cur-p deferImage lazy" data-original="https://source.unsplash.com/500x500" data-popupname="pwGuide3" data-target="#popup" data-toggle="modal"></div>
</div>
</div>
</div>