I have a simple if-else statment like so:
var x = width of child div.
if(x > 165)
{
set div width to 165px.
{
else
{
set div width to width of child div.
}
Which works the first time, any time after that only the first part of the statement will work. No matter if you go to another page and back or refresh several times.
Using Mootools 1.4.1
http://jsfiddle.net/ksR58/2/. This is really annoying me.
It doesn’t show the fault in jsFiddle. But that’s the code I’m using, on refresh in Firefox 7 the div that contains the text “Name of title.” would be at the right length, after a second refresh the width would be 165px. I do not understand how that can happen.
Works fine in Google Chrome.
Update: I’ve tested a revised version of the jsFiddle code on a separate project on my localhost and it works 100% like it should. Grrr…
A crazy total left field cause, I was loading a google font with the tags in the header after I loaded my CSS, the javascript was run on the page once all javascript had been loaded NOT when the DOM was ready.
Added a window.addEvent(domready) to the loading of my javascript and it works fine. 😀