1

我知道我需要使用回调,html()这样直到 after 才会发生这种情况fadeOut(),但是在fadeOut()回调中我无法访问$(this)from .hover

我尝试使用 传递选择var point,但它不起作用。

if(!$.browser.msie) {
    points = $("div.point");
} else {
    points = $("div.flash");
}

问题领域

$(points).hover(
    function () {
        var point = $(this);
        $('#features_key').fadeOut('normal', function (point) {
            $('#features_key').html(point.next('.info').clone()).fadeIn('normal');
        });
    },
    function () {
    }
);

HTML

<div class="feature" id="feature0">
    <div class="point"></div>
    <div class="info"><p>Roof System</p></div>
</div>
4

2 回答 2

8

不要使用 point 作为 fadeOut 回调的参数。它将隐藏您之前“捕获”的点变量:

$(points).hover(
    function () {
            var point = $(this);

            $('#features_key').fadeOut('normal', function() {
                    $('#features_key').html(point.next('.info').clone()).fadeIn('normal');
            });
    }, 
    function () {
    }
);
于 2009-06-09T19:18:59.783 回答
0

通过将点作为参数放在回调函数中,您正在重置它在该函数中的值。

于 2009-06-09T19:19:19.047 回答