jQuery slideUp()เมธอด

❮ วิธีการเอฟเฟกต์ jQuery

ตัวอย่าง

เลื่อนขึ้น (ซ่อน) ทั้งหมด <p> องค์ประกอบ:

$("button").click(function(){
  $("p").slideUp();
});

ความหมายและการใช้งาน

เมธอด slideUp() เลื่อนขึ้น (ซ่อน) องค์ประกอบที่เลือก

หมายเหตุ : องค์ประกอบที่ซ่อนอยู่จะไม่ปรากฏเลย (ไม่ส่งผลต่อเค้าโครงของหน้าอีกต่อไป)

เคล็ดลับ:ในการสไลด์ลง (แสดง) องค์ประกอบ ให้ดูที่ เมธอดslideDown()


ไวยากรณ์

$(selector).slideUp(speed,easing,callback)

Parameter Description
speed Optional. Specifies the speed of the slide effect. Default value is 400 milliseconds

Possible values:

  • milliseconds
  • "slow"
  • "fast"
easing Optional. Specifies the speed of the element in different points of the animation. Default value is "swing"

Possible values:

  • "swing" - moves slower at the beginning/end, but faster in the middle
  • "linear" - moves in a constant speed
Tip: More easing functions are available in external plugins
callback Optional. A function to be executed after the slideUp() method is completed

To learn more about callback, visit our jQuery Callback chapter


ลองด้วยตัวคุณเอง - ตัวอย่าง


วิธีการใช้พารามิเตอร์ความเร็วเพื่อระบุความเร็วของเอฟเฟกต์สไลด์


วิธีการใช้พารามิเตอร์การโทรกลับเมื่อเลื่อนองค์ประกอบที่เลือกขึ้นและลง


❮ วิธีการเอฟเฟกต์ jQuery