~~~
$("#btn").click(function(){
$("#test").toggle(1000)})
~~~
jquery提供的切換語法
is(":visible") :返回boolean值,判斷元素是否可見
toggle() :在show和hide之間切換
~~~
console.log($("#test").is(":visible"))
//獲取并判斷
if($("#test").is(":visible")){
$("#test").hide(1000)
}else{
$("#test").show(1000)
}// 切換
~~~
- 第一章 git
- 1.1 git基本語法
- 1.2 版本回退
- 1.3 ssh的配置
- 第二章 markdown基本語法
- 第三章 HTML CSS
- 3.1 html基礎知識
- 3.2 css基礎
- 3.3 img垂直居中
- 3.4 清除鼠標懸停抖動
- 3.5 字體、列表、表格、文本、鏈接樣式
- 3.6 屬性繼承
- 3.7 float
- 3.8 定位
- 3.9 li加邊框文字移動問題
- 3.10 title旁邊的小圖標
- 第四章 Vue
- 4.1
- 第五章 JavaScript
- 5.1 基本語法
- 5.2 DOM事件
- 5.3 事件
- 5.4 jQuery引用
- 5.5 顯示與隱藏
- 5.6 回到頂部
- 第六章 jQuery
- 6.1 基礎語法