スライダーを機能させようとしています。私はそれを作る方法を知っていますが、私は使用しようとしています toggle()
..それは非常に難しいことが証明されていますが、私が知らないことを誰もが知っていますか?
$("#slider").on("click", function () {
$("#slider").toggle(function () {
$(this).animate({
"height":"100px"
}, 1000);
}, function () {
$(this).animate({
"height":"0"
}, 1000);
});
});
回答:
回答№1は0$("#slider").toggle(function () {
$(this).animate({
"height":"100px"
}, 1000);
}, function () {
$(this).animate({
"height":"20px"
}, 1000);
});
このフォームの正しいバージョンは この
注:この関数はjQuery 1.8で非推奨になり、1.9で削除されました https://api.jquery.com/toggle-event/。したがって、使用しないことを強くお勧めします。