1

height()在为每个具有不同变量的多个加载元素声明变量后,该animate()函数似乎没有加载变量excHeight

使用以下值的最佳方法是excHeight什么animate()

$(".exPand a").click(function (event) {
    event.preventDefault();

    var post_id = $(this).attr("rel");

    var postHeight = $(this).closest('.boxy')
                            .find('.articleImageThumb')
                            .height();

    var excHeight = $(this).closest('boxy')
                           .find('.articleImageThumb')
                           .find('.initialPostLoad')
                           .height();

    $.ajaxSetup({cache:false});

    $(this).closest('.boxy')
           .animate({height: postHeight+excHeight}, 1000);

    $(this).closest('.boxy')
           .find('.articleImageThumb')
       .animate({top: 0}, 1000);

    $(this).closest('.boxy').find('.articleTitle')
    .animate({bottom: excHeight}, 1000);

    $(this).closest('.boxy').find('.postmetadata')
    .animate({bottom: excHeight}, 1000);
});
4

1 回答 1

4

似乎它不起作用,因为您在boxy类名中忘记了“点”:var excHeight = $(this).closest('boxy'),必须是这样的:var excHeight = $(this).closest('.boxy')

于 2013-06-27T17:41:47.390 回答