Main

September 11, 2006

Neat little example of a useful JavaScript closure

I just picked up the 5th edition of David Flanagan's JavaScript, the Definitive Guide. I find it amusing that that book is the only JavaScript book officially recommended at comp.lang.javascript.

Continue reading "Neat little example of a useful JavaScript closure" »

June 11, 2006

Hover Detail

Tonight I added a hover detail to the Flickr thumbnails on the right. If you mouse over a thumbnail, you can see a large version of the photo. If you click on the large photo, its Flickr page loads in a new window.

I'm using the MTFlickrPhotos plugin to generate thumbnails, and to write the HTML for the large images into a hidden DIV. I'd like to load the large images asnchronously, but I need to work out how to request images. So far I've just used Ajax.Updater to preload HTML.

Oh yes, did I mention that the hover details are completely hosed in IE?

June 07, 2006

Explicitly Trigger A JavaScript Event Handler


<script type="text/javascript">
function foo(){ alert("Hello World") }
</script>
<div id="bar" onclick="foo();">click me to see an alert</div>
<div onclick = "document.getElementById('bar').onclick()" > click me to do the same thing </div>

This is trivial, but the subject came up at work today; and I wound up making a little demo, which I'll now post.

Explicitly Trigger An Event Handler in JavaScript

June 05, 2006

Position an element above the fold dynamically with JavaScript

I put together some JavaScript to keep an element above the fold.

This was written at the last minute for the Barney's New York launch; to spruce up the admin tool for their new web site. I only had time to test it in IE6 and Firefox 1.x, but I believe it works in Safari as well. Additionally, I do know that this bit of code has been in use internally at Barney's for a few months now without any complaints coming back. So it may work well on older browsers too; although I believe there are compatibility issues with document.body.clientHeight in some browsers.

Continue reading "Position an element above the fold dynamically with JavaScript" »