Archive for May, 2009

jQuery document ready vs Safari

Thursday, May 7th, 2009

When I had been fiddling with the tweenmenu I had to realize that sometimes offsetLeft or position().left doesn’t work in Safari/Chrome – like many others (Paul Carey, Dave Methwin, Yereth) I came to the conclusion that the problem is with jQuery document.ready though it is very very rare (assuming one moved all the css before scripts!!), but sometimes it does happen (like others noted in the bugtracker).

After some experimenting and deleting 99% of this post :) – adding an empty style tag dinamically magically fixes the problem:

(function(){
if (!/WebKit/i.test(navigator.userAgent)) return;
var el = document.createElement("style");
el.type = "text/css";
el.media = "screen, projection";
document.getElementsByTagName("head")[0].appendChild(el);
el.appendChild(document.createTextNode("_safari {}"));
})();

My sIFR clone

Friday, May 1st, 2009

To learn a bit of a flash I created a (yet another) sIFR clone: docs, flashdevelop project file and demo page are on rosamez.com. As a conclusion I must say, debugging in FD is quite a pain, add some SwfObject idiosyncracies and you’re ready for a nice headache.