$(this) を jQuery fadeOut コールバックに渡す
-
13-09-2019 - |
質問
コールバックを使用する必要があることはわかっています。 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>
解決
フェードアウトのコールバックへのパラメータとしてポイントを使用しないでください。前に「キャプチャ」したポイント変数が非表示になります。
$(points).hover(
function () {
var point = $(this);
$('#features_key').fadeOut('normal', function() {
$('#features_key').html(point.next('.info').clone()).fadeIn('normal');
});
},
function () {
}
);
他のヒント
コールバック関数にパラメータとしてポイントを置くと、その関数内でその値をリセットします。
所属していません StackOverflow