Skip to content

My First WordPress Plugin!

Dear Reader,

I looked up at the clock last night and it was midnight. I’d been tinkering with this idea for 5 hours without stopping. (God, I love it when I get a burr under my saddle!) You programmers in the audience will know what I mean.

This is not an original idea. I saw the guys at Zimbra demo this feature in their mail client at Web 2.0. It struck me as a cool and easy to implement idea. So I set about implementing it. I first did it manually on my resume…just because I start all good projects with my resume. Once I had it working I decided I wanted it in my blog but I really didn’t feel like going back and retrofitting all the URLS with the mouseOver and mouse Out attributes. So I decided a plug-in was in order.

Also, I wanted to see how easy it was to write a WordPress plug-in. My hat is off to you guys. The plug-in was the easiest part of the whole task. Actually getting both IE and FF to play nice was the hard part! When I implemented it on my resume, the JavaScript code to find the current mouse position in IE was:

posx = e.clientX + document.body.scrollLeft;
posy = e.clientY + document.body.scrollTop;

For some reason in the WP environment, that does not work. I had to modify it to say:

posx = e.clientX + document.documentElement.scrollLeft;
posy = e.clientY + document.documentElement.scrollTop;

I’m not sure why it worked in one environment and not the other so I’m gonna research that. Other than that it was pretty easy and a fun way to kill an evening! (Well, I stopped for Veronica Mars but c’mon…who wouldn’t!)

Anyhow, here it is if you want to implement it on your own blog.

Until next time, it’s cold here too…just not AS cold. :)


5 thoughts on “My First WordPress Plugin!

Comments are closed.