:path

详细介绍

: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.

推荐源码