I learned that function toggle() is deprecated. So what can i use instead toggle for this example:
<div id="block" style="width: 200px; height: 150px; background-color: blue"></div>
<span id="click">hide</span>
?
$("#click").toggle(
function(){
$("#block").slideUp();
$(this).html('show');
},
function(){
$("#block").slideDown();
$(this).html('hide');
});
http://jsfiddle.net/2rERJ/
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…