Javascript 如何';幻灯片&x27;div的剩余部分?
我有一个div,我正在使用绝对定位和隐藏溢出显示顶部的一部分。当你悬停在我想显示的div的其余部分。这个div可以是不同的总高度根据内部的信息 以及jQuery:Javascript 如何';幻灯片&x27;div的剩余部分?,javascript,jquery,html,css,css-animations,Javascript,Jquery,Html,Css,Css Animations,我有一个div,我正在使用绝对定位和隐藏溢出显示顶部的一部分。当你悬停在我想显示的div的其余部分。这个div可以是不同的总高度根据内部的信息 以及jQuery: $(item).find('.info').toggleClass('showLittle showAll'); 正如你所看到的,我让它在从一个“砰砰”跳到另一个的地方工作。我真正想要的是它的动画和上下滑动,而不仅仅是从一个“弹出”到另一个 有什么建议吗?不要使用top属性,而是使用负值bottom值: .showLittle {
$(item).find('.info').toggleClass('showLittle showAll');
正如你所看到的,我让它在从一个“砰砰”跳到另一个的地方工作。我真正想要的是它的动画和上下滑动,而不仅仅是从一个“弹出”到另一个
有什么建议吗?不要使用
top
属性,而是使用负值bottom
值:
.showLittle {
bottom: -105px;
}
然后使用转换:
.info {
transition: all .2s;
}
演示:
如果需要动态高度,另一种方法是使用jQuery计算偏移:
var elementHeight = -($('.info').height() - 34);
console.log(elementHeight);
$('.showLittle').css('bottom', elementHeight);
并设置以下CSS:
.showAll {
bottom: 0 !important;
}
演示:不要使用
top
属性,而是使用负值bottom
值:
.showLittle {
bottom: -105px;
}
然后使用转换:
.info {
transition: all .2s;
}
演示:
如果需要动态高度,另一种方法是使用jQuery计算偏移:
var elementHeight = -($('.info').height() - 34);
console.log(elementHeight);
$('.showLittle').css('bottom', elementHeight);
并设置以下CSS:
.showAll {
bottom: 0 !important;
}
演示:不要使用
top
属性,而是使用负值bottom
值:
.showLittle {
bottom: -105px;
}
然后使用转换:
.info {
transition: all .2s;
}
演示:
如果需要动态高度,另一种方法是使用jQuery计算偏移:
var elementHeight = -($('.info').height() - 34);
console.log(elementHeight);
$('.showLittle').css('bottom', elementHeight);
并设置以下CSS:
.showAll {
bottom: 0 !important;
}
演示:不要使用
top
属性,而是使用负值bottom
值:
.showLittle {
bottom: -105px;
}
然后使用转换:
.info {
transition: all .2s;
}
演示:
如果需要动态高度,另一种方法是使用jQuery计算偏移:
var elementHeight = -($('.info').height() - 34);
console.log(elementHeight);
$('.showLittle').css('bottom', elementHeight);
并设置以下CSS:
.showAll {
bottom: 0 !important;
}
演示:您不需要Javascript,只需使用CSS即可
.info {
bottom: 0;
margin-bottom: -102px;
transition: margin 0.5s ease;
}
.tree:hover .info {
margin-bottom: 0;
}
您不需要Javascript,只需使用CSS即可
.info {
bottom: 0;
margin-bottom: -102px;
transition: margin 0.5s ease;
}
.tree:hover .info {
margin-bottom: 0;
}
您不需要Javascript,只需使用CSS即可
.info {
bottom: 0;
margin-bottom: -102px;
transition: margin 0.5s ease;
}
.tree:hover .info {
margin-bottom: 0;
}
您不需要Javascript,只需使用CSS即可
.info {
bottom: 0;
margin-bottom: -102px;
transition: margin 0.5s ease;
}
.tree:hover .info {
margin-bottom: 0;
}
其中一个问题是,我将有多个
.tree
框。我无法像您所描述的那样使用jQuery动态设置底部
值,因为每个树
框的底部
值都需要不同。看:好吧,我想我想出了一个解决办法。请参阅:其中一个问题是我将有多个.tree
框。我无法像您所描述的那样使用jQuery动态设置底部
值,因为每个树
框的底部
值都需要不同。看:好吧,我想我想出了一个解决办法。请参阅:其中一个问题是我将有多个.tree
框。我无法像您所描述的那样使用jQuery动态设置底部
值,因为每个树
框的底部
值都需要不同。看:好吧,我想我想出了一个解决办法。请参阅:其中一个问题是我将有多个.tree
框。我无法像您所描述的那样使用jQuery动态设置底部
值,因为每个树
框的底部
值都需要不同。看:好吧,我想我想出了一个解决办法。见: