如何解决动画高度Jquery
我有一个内容动画-从半高到全高。我唯一的问题是内容会增加而不是减少。焦点仍然停留在我单击以展开的按钮上。 该按钮位于扩展的div底部。
<div class="product-description position-relative mb-2">
<div class="product-description-collapsable pb-3" id="productInfo" data-collapsed="true">
<?php
$productDescription = $product['ProductDescription']['long_description'];
echo $this->Texts->prepareText($productDescription);
?>
</div>
<button id="expandProductDetails" class="show-more-description-button position-absolute btn mx-auto px-3 py-2"><?php echo __('Less more'); ?><i class="icon--chevron-bottom ml-2"></i></button>
<div class="bottom-shadow position-absolute w-100"></div>
</div>
this._container = $("#expandProductDetails")
private toggleBrandsContainer(ui) {
let contentHeight = this._container[0].scrollHeight;
if (this._container.attr("data-collapsed") === "true") {
this._initHeight = this._container.outerHeight();
this._container.animate({
top: 0,height: contentHeight
},200,() => {
this.changeButtonIcon(ui.target,"icon--chevron-bottom","icon--chevron-up-e");
this._container.attr("data-collapsed","false");
if(this._bottomShade !== undefined ) {
this._bottomShade.hide(50);
}
});
} else {
this._container.animate({
height: this._initHeight,},"icon--chevron-up-e","icon--chevron-bottom");
this._container.attr("data-collapsed","true");
if(this._bottomShade !== undefined ) {
this._bottomShade.show(50);
}
});
}
}
如何使内容向下滑动而不向上滑动?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。