How do I add to this scrolling function, to change the color of the scrolled ID?
$ (function () {$ ('a [href * = #]: no ([href = #])'). Click (function () {if (location.pathname Replacement (/ ^ \ //, '') == this.pathname.replace (/ ^ \ //, '') and location.hostname == this.hostname) {var target = $ (this.hash ); Target = target.length? Target: $ ('[name =' + this.hash.slice (1) + ']'), if (target.length) {$ ('html, body'). {ScrollTop: target.offset (.) Top}, 1000); return back;}}}}}};
Add this to the font-color case
target.css ('color', 'red');
After
target = target.length? Target: $ ('[name =' + this.hash.slice (1) + ']');
Or within the callback function of the animation:
$ ('html, body'). Chetan ({scrollTop: target. Offset () .top}, 1000, function () {target.css ('color', 'red');});
If you want to clear other links You can use it:
$ ('a [name]'). CSS ('color', 'black');
Update
In your case you are adding color to p
-tag. You have to change your selector:
$ ("p [id = = 'faq_']"). CSS ('color', '# 707070');
No comments:
Post a Comment