[我知道我需要使用回调,以便直到html()
之后才发生fadeOut()
,但在fadeOut()
回调中,我无法从$(this)
访问.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>
不要将point作为您的fadeOut回调的参数。它将隐藏您之前“捕获”的点变量:
$(points).hover(
function () {
var point = $(this);
$('#features_key').fadeOut('normal', function() {
$('#features_key').html(point.next('.info').clone()).fadeIn('normal');
});
},
function () {
}
);
通过在回调函数中将点作为参数,您可以在该函数中重置它的值。