January 13, 201016 yr $(document).ready(function () { $("#nav li.current-page a").animate({color:"#3ea8bd"}, 1800); $("#nav li.current-page a span").animate({color:"#9bd7e3"}, 1800); }); Can somebody please tell me why this little bit of jQuery is causing so many problems for me. Most of the time it works but other times it totally fails to have any effect - the problem is especially prominent in Safari 4 on mac. I feel like I'm missing something really basic! You can see the actual page in action here if that helps: http://positive-intent.com/beta/ Thanks in advance for any answers :-)
January 14, 201016 yr The ability to animate the color properties isn't built into the jQuery core. You either need the colour plugin, or i think it may be built into jQuery UI. Just a suggestion.
January 14, 201016 yr Author thanks bocaj sorry i should have mentioned i'm already using the color plugin
January 17, 201016 yr Author ok i'm still having no luck with this problem. i'd say about 30% of the time on Safari it works. I cant even figure out what is causing the problem... let alone find a way to fix it. I'd really appreciate an answer if someone has one. thanks again! :-)
January 18, 201016 yr I use jQuery and the colour (fade) all the time. If something's not working start a blank page and code JUST the colour animation with the minimum amount of unnecessary code. There doesn't appear to be a class "current-page" either so that code isn't going to work as it is and I'm not sure if you can target the span (although you should be able to). Also you're trying to animate the same link in two different ways. The point is make the code simple to ensure it's working. The code you posted will animate on document ready not on a (useful) event (like a mouseover). I'd also add a .stop() on event animations to prevent cue build up. Try to animate all the links on the page, without targeting specific ones. $(document).ready(function () { $("a").animate({color:"#3ea8bd"}, 1800); });
January 18, 201016 yr Author Thanks Mesa. yes animating all links does work that way so the problem is probably with attempting to animate two parts of the same links. The class current-page is used on every page other than the first and the effect works almost always on all browsers except safari where 20% of the time it fails for no apparent reason. Also I want the links to fade in on document ready which is why I did not include a specific event. Do you have any idea why safari would have a sporadic problem and not the others?
Create an account or sign in to comment