tags:

views:

35

answers:

1

When watching a YouTube video, a user can click "Share" or "Playlists" and a panel containing relevant FORM elements will appear below it. I would really like to find a simple jQuery example that shows how to implement a behavior very much like it -- just the UI behavior -- complete with the "close" option.

A: 

Your best bet would be to look into jQueryUI and their Tab function. This will allow you to set up links, that when clicked on, will show their own pane of information.

It's worth noting that things can get tricky if you intend to put something like an accordion inside of the tabs. It's otherwise a very versatile method and also includes the ability to remember which tab the user had open in a cookie, so that the next time the user is shown this dialog, it will be where it was left.

Unfortunately that is as simple as you are going to get. I will admit their documentation isn't the best place to look at code examples sometimes. Luckily I was just working on implementing some tabs myself over at www.sneakyness.com. All the code is inside of Sneakyness.js. What you're looking for is at the very bottom. The extra code I have is to enable things like accordion inside of tabs. It's also worth noting that I load the content of each tab from individual files instead of keeping it all on one page, makes it a bit neater.

Sneakyness