想知道是否有人对这个难题有答案?
我有一些Jquery在点击某些文本时在div中交换内容:
<script type="text/javascript">
$(document).ready(function() {
$("#changeText").click(function() {
$("#textBox").html("<div>This text will be changed to something else. in a div</div>");
});
});
</script>
<a id="changeText">Find out more</a>
<br />
<div id="textBox"><div>This text will be changed to something else</div></div>
但是,当内容被交换时,我希望能够淡出旧内容并淡出新内容。有没有办法做到这一点?
答案 0 :(得分:0)
$("#changeText").click(function() {
$("#textBox").children().fadeOut('fast',function(){
$("#textBox").html("<div>This text will be changed to something else. in a div</div>").fadeIn('fast');
});
});