JQuery语法帮助滑块根据自动高度移动DIVS
我使用一个简单的 jquery 来旋转图像(淡入淡出)并为每个图像设置自动高度(我想我在下面得到了)。
是否可以根据图像高度更改 #top-left div 的高度,并将其下方的 DIV 向上移动。是否有某种淡入淡出功能可以将下方的 div 向上或向下移动?
<div id="top-left">
<div class="slides">
<img src="img/home-n1.jpg">
<img src="img/home-n2.jpg">
<img src="img/home-n3.jpg">
<img src="img/home-n4.jpg">
</div>
</div>
$('.slides').cycle({
fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
height: function() {
var c = jQuery('.slides img');
jQuery('#top-left .slides').height(c.height());
}
});
这两者的某种混合?
height: function() {
var c = jQuery('.slides img');
jQuery('#top-left .slides').height(c.height());
$("#top-left").animate({
height: "70%",
opacity: 0.4,
}, 1500 );
}
I'm using a simple jquery to rotate images (fade) and have an autoheight for each image (think I got that below).
Is it possible to change the height of #top-left div, based on the image height, and move the DIVs below it up.. is there some sort of fade function that would move the divs below up or down?
<div id="top-left">
<div class="slides">
<img src="img/home-n1.jpg">
<img src="img/home-n2.jpg">
<img src="img/home-n3.jpg">
<img src="img/home-n4.jpg">
</div>
</div>
$('.slides').cycle({
fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
height: function() {
var c = jQuery('.slides img');
jQuery('#top-left .slides').height(c.height());
}
});
Some sort of mixing of these two ?
height: function() {
var c = jQuery('.slides img');
jQuery('#top-left .slides').height(c.height());
$("#top-left").animate({
height: "70%",
opacity: 0.4,
}, 1500 );
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用之前的回调:see fiddle
Use the before callback: see fiddle