0
$("a.details")
    .click(function () {
    var $this = $(this);

    $this.parents(".subscription")
        .find('.plan-details')
        .stop(true, true)
        .animate({
        height: ['toggle', 'easeOutBounce']
    }, 'slow',

    function () {
        $this.text(function (i, text) {
            return text == 'View Details' ? 'Hide Details' : 'View Details';);
        }) ,

        function (e) {
            $this.parents(".subscription")
                .find('.plan-details')
                .stop(true, true)
                .animate({
                height: 'toggle'
            });

        });

フィドル: http://jsfiddle.net/6fCrd/

...ここで何が間違っているのかわかりませんが、うまくいきません。バウンス効果で下にスライドし、トリガー テキストも変更する必要があります。

4

1 に答える 1

1

ここに構文エラーがあります:

return text == 'View Details' ? 'Hide Details' : 'View Details';);
// ... and here
$this.text(function (i, text) {
        return text == 'View Details' ? 'Hide Details' : 'View Details';
}, function (e) {

編集

アニメーション効果のためにjquery uiを含める必要があります

私のデモを試してみてください: http://jsfiddle.net/6fCrd/7/

于 2013-01-16T10:18:08.873 に答える