我正在使用enquire.js将我的 RoyalSlider 的高度动态设置为它旁边元素的高度。这在 Firefox 中有效,但在 Safari 加载时,滑块的高度是可能的最小高度(因此是箭头的高度)。只有在我调整窗口大小后,才会调整正确的高度。
enquire.register("screen and (max-width: 53.999em)", {
match : function() {
$('.slide').css('height', "10em");
}
}).register("screen and (min-width: 54em)", {
match : function() {
var height = $('.one:first').outerHeight(true) * 2;
$('.slide').css('height', height);
window.onresize = function() {
var height = $('.one:first').outerHeight(true) * 2;
$('.slide').css('height', height);
}
},
unmatch : function() {
$('.slide').css('height', "10em");
}
});
我试图在 CSS 中为初始加载设置一个静态高度,但样式不适应。