Many Pies

Many Pies

Wednesday, March 17, 2010

Search box on

Before we launched the new site we realised that despite several people looking over the proposed design, we'd missed out a search function. So I had to squeeze one into the top navigation bar.

The way I did it probably wasn't original, but I can't remember where I'd seen it. When you click the search link a text box opens up, obliterating the labels to the right.

You can view the source on the pages to see how it works, so I won't reproduce the code here. I just use a bit of jquery to show the hidden search box and hide the other labels. The other challenge was to make it work for people who don't have javascript enabled. The way I did that was to make the search text a link to a dedicated search page, where you could type in your query. If you have javascript the jquery changes that link to run the bit of code which shows the search box etc. If you don't have javascript you go to the dedicated search page.

I like jquery.

No comments: