动画高度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 (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...