jQuery slideDown()วิธี การ
ตัวอย่าง
เลื่อนลง (แสดง) องค์ประกอบ <p> ที่ซ่อนอยู่ทั้งหมด:
$("button").click(function(){
$("p").slideDown();
});
ความหมายและการใช้งาน
เมธอด slideDown() เลื่อนลง (แสดง) องค์ประกอบที่เลือก
หมายเหตุ: slideDown() ทำงานบนองค์ประกอบที่ซ่อนอยู่ด้วยเมธอด jQuery และ display:none ใน CSS (แต่ไม่ใช่การมองเห็น:hidden)
เคล็ดลับ:หากต้องการเลื่อนขึ้น (ซ่อน) องค์ประกอบ ให้ดูที่วิธี slideUp ()
ไวยากรณ์
$(selector).slideDown(speed,easing,callback)
Parameter | Description |
---|---|
speed | Optional. Specifies the speed of the slide effect. Default value is 400 milliseconds Possible values:
|
easing | Optional. Specifies the speed of the element in different points of the animation. Default value is "swing" Possible values:
|
callback | Optional. A function to be executed after the slideDown() method is completed
To learn more about callback, visit our jQuery Callback chapter |
ลองด้วยตัวคุณเอง - ตัวอย่าง
วิธีการใช้พารามิเตอร์ความเร็วเพื่อระบุความเร็วของเอฟเฟกต์สไลด์
วิธีการใช้พารามิเตอร์การโทรกลับเมื่อเลื่อนองค์ประกอบที่เลือกขึ้นและลง