编程学习 /jQuery /基础语法 /显示与隐藏
🎣 jQuery 基础语法

显示与隐藏

hide、show、toggle 的基本用法。

📅 2026-11-23 👁 0 次阅读 🔗 根据 W3School jQuery 教程整理优化:https://www.w3school.com.cn/jquery/jquery_hide_show.asp

本节要解决的问题

hide、show、toggle 的基本用法。

核心要点

  • 可传动画时长参数
  • toggle 在显示隐藏间切换
  • 无参数时直接切换
$(".box").toggle(300);
频繁动画前先 stop(),避免队列堆积。

本文根据 W3School jQuery 教程 的知识点重新整理、补充示例编写,非原文转载。