jq 動態新增 active 實現導航效果

2021-08-07 13:42:56 字數 1395 閱讀 1675

**思路:

頁面4:

頁面5:

**思路:

通過jq獲取你開啟頁面的鏈結  window.location.pathname;

在html中給自己的li加入乙個id id的命名與**鏈結中的href相同 

通過jq包含方法找到相對應的li給他加入active類名  

然後。。就沒有然後了。。。

jq**:

$(function

()

else}})

html**:

<

body

>

<

div

class

="title"

>

<

ul class

="title_ul"

>

<

li id

="index"

><

a href

="index.html"

class

="">頁面1

a>

li>

<

li id

="zf"

><

a href

="zf.html"

class

="">頁面2

a>

li>

<

li id

="gc"

><

a href

="gc.html"

class

="">頁面3

a>

li>

<

li id

="hc"

><

a href

="hc.html"

class

="">頁面4

a>

li>

<

li id

="shwt"

><

a href

="shwt.html"

class

="">頁面5

a>

li>

ul>

div>

body

>

ADF實現動態新增表單

介紹 在adf的table中,我們能實現在 中新增,編輯,刪除行的功能,以及一行資料中的級聯。然而在多數時候,當一行的列太多,中的資料量不多的時候,這種在table中直接新增的方式則顯得很不友好,因為要來回的拉動橫向的滾動條。那麼有什麼辦法能以表單的方式來新增一行,新增一條資料時新增乙個表單,直到有...

用jq實現盒子動態水平垂直居中套娃

實現的目的如圖所示 介紹一下盒子在盒子中水平垂直居中的技巧 container類為套在最外層的盒子,content類則是盒子裡面的盒子,是我們呢要水平垂直居中的物件 關鍵點在於floater類的作用 floater的高度設為共同父輩盒子的50 給予margin bottom的值為.content高度...

jq 實現點選新增 並定位到最新一行

doctype html en utf 8 viewport content width device width,initial scale 1.0 document title head html body container btn btn button table head li table...