我想我明白你想要做什麼。請讓我知道如果我不是,我會相應地更新我的答案。
這是我很簡單的標記......
<div class="slide">more...</div>
<div class="view">
<span>This is some stuff!</span>
</div>
和腳本...
$(document).ready(function() {
$('div.view').hide();
$('div.slide').toggle(
function() {
$(this).siblings('div.view').fadeIn('slow');
$(this).text("less..."); //change the inner text of the DIV
},
function() {
$(this).siblings('div.view').fadeOut('fast');
$(this).text("more..."); //change the inner text of the DIV
return false;
}
);
});
這將盡快div
點擊更改DIV
文本。
如果你想等到隱藏DIV
顯示更改文本,使用這個腳本:
$(document).ready(function() {
$('div.view').hide();
$('div.slide').toggle(
function() {
$(this).siblings('div.view').fadeIn('slow',
function() {
$("div.slide").text("less...") //change the inner text after the animation is complete
});
},
function() {
$(this).siblings('div.view').fadeOut('fast',
function() {
$("div.slide").text("more..."); //change the inner text after the animation is complete
});
return false;
}
);
});
這是正確的!非常感謝你! – verlager 2010-08-23 01:44:05
@verlager - 歡迎:)請務必接受您最終在您的問題上使用的任何答案:) – 2010-08-23 01:49:56