我正在使用jQuery Cycle制作一些幻灯片,其内容低于它。 jQuery Cycle将父项设置为相对,并将子项幻灯片设置为绝对,因此应覆盖它下面的内容。通常,我会给父容器一个高度来解决我的问题。在响应滑块(jQuery循环)中设置高度
由于布局响应,高度可能会发生变化。那里有一个简单的解决方案吗?
编辑:
这里是清盘这样做对我来说:
$(window).load(function(){
var rotate_height = $('#rotate div img').height();
$('#rotate').css('height', rotate_height);
$(window).resize(function() {
if($(window).width() >= 960){
rotate_height = 290;
$('#rotate').css('height', rotate_height);
$('#rotate').cycle('next');
} else if ($(window).width() >= 768 && $(window).width() <= 959) {
rotate_height = 230;
$('#rotate').css('height', rotate_height);
$('#rotate').cycle('next');
} else if ($(window).width() >= 480 && $(window).width() <= 767) {
rotate_height = 210;
$('#rotate').css('height', rotate_height);
$('#rotate').cycle('next');
} else if ($(window).width() <= 479) {
rotate_height = 150;
$('#rotate').css('height', rotate_height);
$('#rotate').cycle('next');
}
});
$('#rotate').cycle({
fx: 'fade',
fit: 1,
containerResize: 0,
slideResize: 0,
height: rotate_height
});
});
周期(“下一步”)强制滑动到下一个访问者重新调整他们的显示器之后。不理想,但只有在幻灯片更改后,图像才会缩小。
一些示例代码将是有益的。 – Starx 2012-02-27 04:37:34
很高兴概念上的'微动'足以引导你找到解决方案! – deefour 2012-02-27 16:03:18