Jquery address bar link matching special effect code Summary (2), jquery special effect code
As described in, when such a function appears,Click a link to add a style to the link address after the jumpTo add a special style by adding class as current.
: Click HTML + css3 to jump to and add a style to it:
The js Code is as follows:
Var currUrl = window. location. href; var currStyle = function (links) {links. each (function () {var url = $ (this ). attr ('href '); if (currUrl. indexOf (url )! =-1) {$ (this). addClass ("current"); return false ;}});}
How to call it? The following jquery call code:
$ (Function () {currStyle ($ ("# sidebar. list "));})
In this way, the function is implemented.
Author: rainbow after the storm
Source: http://www.cnblogs.com/moqiutao/
If you think this article is helpful to your learning, please provide more support and encouragement.