I started on this site a few weeks ago and had very clean, efficient code in place then before I could finish my life went haywire and the graphic designer took over and the code got largely out of my control. So when you look at it you'll see lots of quirky code things that aren't mine but I can't blame the designer for doing what they had to. And now I am back on the project just trying to get things wrapped up. Anyways... I am using jQuery to highlight current page links (there's a reason I'm not using PHP in this particular project) but IE8 doesn't seem to recognize the code. Any thoughts?
This may or may not help, but it confuses browsers if you link to the JQuery library more than once. You should only have one link to it, but you have two links in your head (meaning double the massive download):
Remove one of those (I would get rid of the first one) and see if that helps.
Ever thought highlighting/styling with pure CSS, instead of using jQuery all together?
Can you highlight a current page link with just CSS?
Thanks for the responses, everyone. I've got my own computer up and running now and am trying to get this fixed. I am trying to remove the multiple instances of jQuery. I removed one of the three and left two and things worked fine but when I tried to remove either instance of the remaining two things went kaflooey. Part of the problem, though probably not the whole problem, is that IE8- has problems with both of Google's CDN files included, and it has a different problem with each file. I thought we would be able to trust those things. If I was able to get one instance and one instance only of jQuery running it might solve the "highlight current link" problem. I have found out that IE8- is not recognizing at least certain instances of "$" or "jQuery" so there might be a conflict going on with some of the other scripts. If I had been the only one building the site I would've caught the conflict as soon as it came up. But now with so many scripts in place it is hard to locate the conflict.
Perhaps they are different versions, and one of the scripts depends on a later version. Having multiple links to the jQuery library is like running a new power cable into your house every time you want to add a new power point. Of course, you only need on electricity cable into your house to power the whole thing.
Make sure that the one library link sits above any other jQuery scripts. As you say, it's tough with a lot going on in the page, but it may be worth stripping the scripts out and adding them back in one by one. Then you know where the problem starts. Also, I'd recommend putting all scripts at the bottom of the page (just before the closing <body> tag). It seems to cause problems if you have the jQuery library linked at the top of the page but other jQ scripts at the bottom of the page, so I prefer to keep them all together, and preferably at the bottom, as the page visually loads faster that way (I find, anyhow).
That's already been suggested in this thread. But it's a good suggestion.
This topic is now closed. New replies are no longer allowed.