我正试图将image1的高度分配给图像2,在边缘、Chrome和Firefox中工作得很好。IE11不工作,也没有错误消息。这是它在Edge、Chrome和Firefox中的样子:没有问题:

在IE11: IE11发行版中:

function setIntHeight() {
var g1 = $('.grid-tile').eq(0),
h = g1.find('img').height();
$('.interruptor1, .interruptor2').height(h);
}
function interruptorHeight() {
$(window).on('load', setIntHeight);
$(window).on('resize', debounce(setIntHeight));
}
interruptorHeight();<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!--Image 1-->
<li class="grid-tile">
<div class="product-tile" >
<div class="product-image">
<img src="https://development-na01-arden.demandware.net/dw/image/v2/BBVB_DEV/on/demandware.static/-/Sites-master-catalog/default/dwf7e4c6a8/images/large/8B-AP04151-cc521986-d8f4-4c81-b43a-787622068cba.jpg?sw=265&sh=398&sm=fit" alt="PLUS Blessed Tee">
</div>
</div>
</li>
<!--Image 2-->
<li class="bg-image grid-tile interruptor1">
<img src="https://development-na01-arden.demandware.net/on/demandware.static/-/Sites-ardene-Library/default/dwb58b67e0/homepage/MasonryImage5.jpg" alt="PLUS Blessed Tee" >
</li>
发布于 2018-10-16 17:43:56
$(window).on('load',setIntHeight);在IE11中不能正常工作。请尝试使用:
window.onload = function() {
setIntHeight();
};
网站上有很多解释,到处都是研究。
https://stackoverflow.com/questions/52292559
复制相似问题