:path

联合创作 · 2023-10-02 14:23

:path is a pseudo-class selector written in jquery. It automatically filters out href attributes that matches the window location and it's ancestors. Use it to style or modify active states in navigations without server-side interaction.

Usage (example):
$('ul a:path').parent().addClass('active');

Comes bundled with the similar selector :current that filters out hrefs that points to the very same page that the window.location returns.

浏览 5
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报