I have a strange JavaScript problem using window.location.href, which apparently only affects Firefox (I’m using 3.6). Normally window.location.href would not be read-only, and this works perfectly in Firefox: However, when I call a function in response to an onunload event (<body onunload=”tes…
Why doesn’t this Javascript RGB to HSL code work?
I found this RGB to HSL script over at http://www.mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript. I can’t find any other small decent ones. The issue is that this code doesn’t even really work. Would anybody know why? (I don’t know a bit of c…
Waiting for image to load in JavaScript
I’m making an Ajax call which returns me some info including an image path. I prepare all this information in my HTML which will be displayed as a kind of popup. I just toggle the visibility of by popup div from hidden to visible. To set the position of my popup div, I have to calculate depending on the…
jQuery vs. javascript? [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 9 years ago. Improve this question I recently stumbled upon some javascript forums (sadly, link is lost …
Mouse event weirdness
Here is the Greasemonkey script I’m working on (source below): http://userscripts.org/scripts/show/69722 You can test it out on this page: http://forums.whirlpool.net.au/forum/35 Hover over a thread title and a div appears with a preview. The weird thing is, when you move your mouse around on the div, t…
What is the non-jQuery equivalent of ‘$(document).ready()’?
What is the non-jQuery equivalent of $(document).ready()? Answer This does not answer the question nor does it show any non-jQuery code. See @ sospedra’s answer below. The nice thing about $(document).ready() is that it fires before window.onload. The load function waits until everything is loaded, incl…
Browser-independant workaround for onload event — making sense?
I have recently found myself playing around with events, and as there is no standard for the event indicating that a page has been loaded (like onload vs. pageshow) I wondered whether something speaks against simply putting some JavaScript at the end of the page. This code would then be executed when the page…
Detect a finger swipe through JavaScript on the iPhone and Android
How can you detect that a user swiped his finger in some direction over a web page with JavaScript? I was wondering if there was one solution that would work for websites on both the iPhone and an Android phone. Answer Simple vanilla JS code sample: Tested in Android.
Testing if jQueryUI has loaded
I’m trying to debug a website, and I think that jQueryUI may not have loaded properly. How can I test if jQueryUI has loaded? Answer OR Should do the trick
Is it possible to get the location/position of the mouse cursor on document load event
Just wondering if its possible to get the x/y location of the mouse from the onload event of the document (before any mousemove events)? Answer short answer: no long answer: yes. the onload event doesn’t provide info on the mouse position, however you can set a variable when onload has fired, and use th…