15 Javascript Snippets You Can’t Live Without
Coding March 27th, 2007Please Note: We have moved to our new home WebCodr.com - please update your links and bookmarks!
You either love Javascript or you hate it. Either way it can provide great functionality that users love. And it doesn’t have to affect usability. Here are my top 15 Javascript snippits for making great sites that bit extra special.
Crisp photography is a sure-fire way to make a site look great, but what about the loading times of those chunky images? Give your users a nice animated loading icon, and fade the image in when it’s loaded. It’s a nice effect with little overhead.
HTML tables are so last century. ActiveWidgets provide a dynamic data table library, allowing users to sort data by columns and highlight rows of interest. It is, however, a large overhead and not suitable for large amounts of data.
Asking users to enter a valid date can be a pain - frustrating for the developer, and frustrating for the user. Offer them a simple GUI to select dates with this very customizable script.
Tabs are great for sorting short snippets of information. Tabs without reloading the page are even better. Tabs with a rolling animation effect too? Well, that’s just killer.
These draggable windows are lightweight and efficient, and are perfect for intranets and web-based applications where multiple views are required simultaneously. And don’t worry, you needn’t have the Windows 95 look either.
One subject, many photos? These tidy thumbnail displays are just the ticket, allowing visitors to blow up photographs of interest. Similar to those found on eBay and such, but not as heavy on the code.
A favourite little effect of mine found on many good sites these days - the Javascript Lightbox. Enlarge photographs with slick animation and easy-to-use navigation. Put a smile on the CEOs face and wow the marketing team ready for your “afternoon meeting” down the pub.
Get your visitors from Google Search to card payment in ninja time, with a drag-and-drop shopping cart. Reducing page loads, form elements and complicated menu screens increases sales and repeat business. But with mission-critical code like this, make sure to test it on every platform before it goes live. You know this. I was just reminding you.
No one likes a smartass, unless they’re doing your homework for lunch money. Let this script do your users’ hard work so they don’t have to - autocomplete from a selection of known data. Great for street addresses (if you have the data), category selection, search engines, tagging and everything inbetween.
Nothing says “I love you, user” more than drag-and-drop items. Remember the days of an “order” column, and wanting to insert an item at the top? Nightmare no more! Slick interface with a very practical purpose.
Javascript Logging & Debugging
“PC Load Letter?! What the hell is PC Load Letter!!” cries from the office. Meaningless error messages are enough to drive a man crazy, so why not step up your debugging skills and hunt those bugs in style?
After spending days getting your web site pixel perfect, inconsiderate users will always resize your text and ruin your layout. Well okay, they need to because their eyesight can’t comprehend your 6pt type. Which means you need to support different font sizes without ruining your layout.
Displaying Points & Text On Maps
If your data is geolocation based, it looks great on a map with clickable points. But how do you make that interface accessable to everyone? A List Apart shows you how.
A more advanced way of displaying your pictures - let users sort them by category, view random pictures, and even set up a personal slideshow. Probably more suitable for family pictures than commercial uses, but I’ve found it handy over the years.
And finally another slick animation for your site, without the overhead of Scriptaculous, create “Digg-style sliding comment boxes” for popup information.
Well that’s it from me. I hope you enjoy putting some of these into practise, and enjoy the look on your CEO/client/marketing guy’s face when it goes live.














March 28th, 2007 at 6:39 am
Nice list, image fading wins the list for me.
Took me until the bottom of the list to notice you’ve got the same theme as my site. :s
March 28th, 2007 at 7:13 am
nice, many scripts was very useful =)
March 28th, 2007 at 7:26 am
the most useful one is the one which protect your address mail from spam.
March 28th, 2007 at 8:20 pm
re: image loading; I’ve been doing something similar with my larger images, but w/ less overhead and less flair… i just have a small sub 1k gif that says “loading…” maybe animated dots or something not annoying set center center as the BG for the image: img { background: transparent url(loading.gif) no-repeat center center; } and thats it… when the image loads it’ll automatically cover up the background loading gif, and there’s no JavaScript, much less CSS, and is rather un-introusive. not sure if it’s a “better” solution, but certainly a lightweight alternative.
March 28th, 2007 at 11:22 pm
Nice, I saw you had 1941 diggs for your article, that’s TRULY impressive!
)
What’s the trick?
How does it feel after you’ve had success now…?
(
PS!
If you’re into ScriptAculous (your shopping cart) you might want to check out how we’ve utilized it
like:
http://ajaxwidgets.com/AllControlsSamples/LiveMapsMashup.aspx
or
http://ajaxwidgets.com/AllControlsSamples/TabControl.aspx
I think those “draggables” will slain most others any time of the day
March 29th, 2007 at 1:08 am
Thanks mate!
The Tabbed RollBar link however is dead
March 29th, 2007 at 3:59 am
Thanks for the list this is very useful..
March 29th, 2007 at 3:00 pm
tks a lot
March 29th, 2007 at 5:41 pm
Great collection!
March 30th, 2007 at 1:53 am
Image fade has got to be number one. It’s going on my web page ASAP
March 30th, 2007 at 2:51 am
Good list. The lightbox stuff is cool.
March 30th, 2007 at 3:00 am
Great list, thanks for the compilation
March 30th, 2007 at 5:51 am
Wow. An organized and great collection of useful scripts. Thanks for sharing.
March 30th, 2007 at 11:50 am
Image fading is great, not sure how the rest made the list. They might be cool and snazzy but do they really add much value?
March 30th, 2007 at 3:11 pm
Very good list of useful interactive web design elements - great work!
April 4th, 2007 at 7:06 am
Wonderful~~~~~~~~~~~~~~~~~~~~~~~~
April 4th, 2007 at 6:45 pm
Very impressive! Thank you.
April 6th, 2007 at 1:35 am
The site looks great ! Thanks for all your help ( past, present and future !)
April 9th, 2007 at 2:54 am
Thank you very much ! really useful scripts! Thanks for sharing !
April 9th, 2007 at 6:24 pm
Excelente colección de códigos en Javascript!!! - Saludos del Perú.
April 11th, 2007 at 9:40 pm
Thanks for the list, it’s be nice if they were all open source.
April 14th, 2007 at 7:25 am
these javascript stuffs are quite stupid. There are many more useful javascript codes like mootools framework or tooltip and reflection javascript which have not been included to this list. Nevertheless, worth a look…
April 22nd, 2007 at 3:28 pm
My two favorites are the grid and the auto complete.