Hover.js
I think I fixed a javascript file – and I don’t even know javascript!
If I visited my site, down on the bottom left I was seeing this error message – you know the one, done but with errors on the page. The errors were with the hover.js file and if I opened up the details it told me ‘line something, character something, expecting a ;’. This is a file that comes with my theme, Deep Blue.
So I played around with that and then it would give me another error message, line something, yada yada.
I tried a bunch of different configurations and finally got one that didn’t give me an error message. So I’m assuming I fixed it, but who knows whether or not something will stop working properly now.
Here’s what the new code is:
sfHover = function() { var sfEls = document.getElementById("menu").getElementsByTagName("li");
for (var i=0; i
sfEls[i].onmouseover=function()
{
this.className+=" hover" };
sfEls[i].onmouseout=function()
{
this.className=this.className.replace(new RegExp(" hover\\b"), ""); }
}
}; if (window.attachEvent) window.attachEvent("onload", sfHover);
And here's what the old code had:
sfHover = function()
{
var sfEls = document.getElementById("menu").getElementsByTagName("LI"); for (var i=0; i
sfEls[i].onmouseover=function()
{ this.className+=" hover"; }
sfEls[i].onmouseout=function()
{
this.className=this.className.replace(new RegExp(" hover\\b"), ""); }
}}if (window.attachEvent) window.attachEvent("onload", sfHover);
If anybody out there knows javascript and can see any errors that might impact me, please feel free to let me know and we can put a real fix in there. Oh, and if something doesn't work properly... let me know that too - not that I know how to fix it, but it would just be interesting to find out what could get screwed up by my little changes.
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments
No comments yet.
Leave a comment