jQuery Effect แสดง ()วิธี การ

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

ตัวอย่าง

แสดงองค์ประกอบ <p> ที่ซ่อนอยู่ทั้งหมด:

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

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

วิธีการแสดง () แสดงองค์ประกอบที่เลือกที่ซ่อนอยู่

หมายเหตุ: show() ทำงานบนองค์ประกอบที่ซ่อนอยู่ด้วยเมธอด jQuery และ display:none ใน CSS (แต่ไม่ใช่การมองเห็น:hidden)

เคล็ดลับ:หากต้องการซ่อนองค์ประกอบ ให้ดูที่วิธีซ่อน()


ไวยากรณ์

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

Parameter Description
speed Optional. Specifies the speed of the show 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 show() method is completed

To learn more about callback, visit our jQuery Callback chapter


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


วิธีการใช้พารามิเตอร์ความเร็วเมื่อซ่อน/แสดงองค์ประกอบ


วิธีการใช้พารามิเตอร์ callback เมื่อทำการซ่อน/แสดงองค์ประกอบ


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