Tabs plugin update: Support for (unobtrusive) Ajax
February 5th, 2007
- Category:
- JavaScript,
- Web Development,
- jQuery
I have updated the Tabs plugin the other day. It now supports loading tab
content via Ajax. As one could have expected I did that in an unobtrusive manner.
The HTML you need is slightly different from the one that is used for static tabs: A list of links pointing to existing ressources (from where the content gets loaded) and no additional containers at all (unobtrusive!). They’re going to be created on the fly:
<div id="container">
<ul>
<li><a href="ahah_1.html">Content 1</a></li>
<li><a href="ahah_2.html">Content 2</a></li>
<li><a href="ahah_3.html">Content 3</a></li>
</ul>
</div>
Initialize the tabs interface with the remote option set to true:
$('#container').tabs({remote: true});
Obviously this will degrade gracefully – the links, e.g. the content, will still be accessible with JavaScript disabled.
All other options and history support should be totally unaffected by that.
There’s another option: While the tab content is being loaded a little spinner left to the tab title text is shown (which you will hardly see on the demo, because it’s loading too fast). Just like in Firefox for example. This is controlled by a CSS class, which you can change:
$('#container').tabs({remote: true, loadingClass: 'progress'});
If you don’t want to show a spinner at all just remove the rule
.anchors .tabs-selected .tabs-loading {
...
}
from the style sheet.
148 Comments
Comments feed
Comment by Stylemo, February 6th, 2007 at 7:40 am
Comment by Daniel, February 11th, 2007 at 9:15 am
Comment by Mike, February 13th, 2007 at 11:45 pm
Comment by Mike, February 13th, 2007 at 11:55 pm
Author Comment
Comment by Klaus, February 14th, 2007 at 9:11 am
Comment by Cifro, February 18th, 2007 at 2:27 pm
Author Comment
Comment by Klaus, February 18th, 2007 at 3:17 pm
Comment by Gilles, February 20th, 2007 at 9:36 pm
Comment by Rack Lin, March 8th, 2007 at 3:19 am
Comment by hugo, March 23rd, 2007 at 8:50 pm
Comment by forrest lyman, March 24th, 2007 at 6:45 pm
Author Comment
Comment by Klaus, March 24th, 2007 at 6:54 pm
Comment by Justin, March 26th, 2007 at 10:22 pm
Author Comment
Comment by Klaus, March 27th, 2007 at 10:00 am
Comment by Ken, March 27th, 2007 at 5:37 pm
Author Comment
Comment by Klaus, March 27th, 2007 at 10:01 pm
Comment by Eric Fehrenbacher, March 29th, 2007 at 7:19 am
Comment by Sérgio Pinto, March 29th, 2007 at 1:02 pm
Comment by Rikard, March 29th, 2007 at 1:24 pm
Comment by Rikard, March 29th, 2007 at 3:12 pm
Author Comment
Comment by Klaus, March 29th, 2007 at 4:10 pm
Author Comment
Comment by Klaus, March 29th, 2007 at 4:14 pm
Comment by Sérgio Pinto, March 29th, 2007 at 4:25 pm
Comment by Bodi, March 29th, 2007 at 5:22 pm
Comment by Andrew Clarke, March 29th, 2007 at 10:21 pm
Author Comment
Comment by Klaus, March 30th, 2007 at 7:29 am
Comment by Alex Objelean, March 31st, 2007 at 10:11 pm
Author Comment
Comment by Klaus, April 1st, 2007 at 9:47 pm
Comment by Rikard, April 3rd, 2007 at 9:36 am
Author Comment
Comment by Klaus, April 3rd, 2007 at 10:14 am
Comment by Rikard, April 3rd, 2007 at 10:27 am
Comment by Rikard, April 3rd, 2007 at 11:11 am
Author Comment
Comment by Klaus, April 3rd, 2007 at 12:24 pm
Comment by Rikard, April 3rd, 2007 at 1:26 pm
Comment by VIRUS in pack.js file?, April 3rd, 2007 at 8:04 pm
Author Comment
Comment by Klaus, April 3rd, 2007 at 10:13 pm
Comment by Dan, April 4th, 2007 at 8:45 am
Comment by astucale, April 5th, 2007 at 2:54 pm
Author Comment
Comment by Klaus, April 5th, 2007 at 3:55 pm
Comment by Rikard, April 5th, 2007 at 6:21 pm
Author Comment
Comment by Klaus, April 5th, 2007 at 8:45 pm
Comment by Rikard, April 5th, 2007 at 9:51 pm
Comment by Tom Stewart, April 6th, 2007 at 11:57 pm
Author Comment
Comment by Klaus, April 7th, 2007 at 12:07 am
Comment by Frank Thompson, April 7th, 2007 at 1:09 am
Author Comment
Comment by Klaus, April 7th, 2007 at 12:23 pm
Comment by Mark, April 12th, 2007 at 12:00 pm
Author Comment
Comment by Klaus, April 12th, 2007 at 1:41 pm
Comment by Mark, April 12th, 2007 at 7:19 pm
Pingback by Show-Hide JS - DesignersTalk, April 13th, 2007 at 10:57 pm
Pingback by Show-Hide JS - DesignersTalk, April 13th, 2007 at 11:36 pm
Comment by jose, April 18th, 2007 at 5:28 pm
Comment by KaBaDaBrA, April 19th, 2007 at 1:35 pm
Author Comment
Comment by Klaus, April 19th, 2007 at 3:15 pm
Author Comment
Comment by Klaus, April 21st, 2007 at 9:59 am
Comment by Gonzalo, April 21st, 2007 at 10:10 pm
Comment by Pedro Melo, April 27th, 2007 at 5:09 pm
Comment by Andres, April 30th, 2007 at 8:57 pm
Comment by Andres, May 1st, 2007 at 11:57 am
Comment by Bruno, May 2nd, 2007 at 9:45 pm
Comment by DaveG, May 7th, 2007 at 2:30 am
Comment by soc, May 8th, 2007 at 4:49 pm
Comment by Adam C., May 8th, 2007 at 6:56 pm
Comment by Henry Jin, May 8th, 2007 at 7:21 pm
Comment by Harinder, May 10th, 2007 at 9:09 am
Comment by Marjan, May 10th, 2007 at 6:23 pm
Comment by Lars Brenna, May 11th, 2007 at 8:12 am
Comment by Lars Brenna, May 13th, 2007 at 10:35 pm
Pingback by commadot.com » Blog Archive » Marketo.com Launched, May 21st, 2007 at 4:31 am
Comment by Dominik Hahn, May 22nd, 2007 at 1:44 pm
Author Comment
Comment by Klaus, May 22nd, 2007 at 2:38 pm
Trackback by mychoice.snehah.com, May 23rd, 2007 at 5:45 am
Comment by Magnus, May 29th, 2007 at 7:22 pm
Comment by Trent Miskin, May 31st, 2007 at 11:04 pm
Pingback by commadot.com » Blog Archive » Plugins, June 1st, 2007 at 6:47 pm
Comment by Holger, June 13th, 2007 at 11:08 am
Author Comment
Comment by Klaus, June 13th, 2007 at 12:55 pm
Comment by Jay, June 14th, 2007 at 9:39 pm
Comment by wheezer, June 15th, 2007 at 5:44 am
Comment by vin100, June 15th, 2007 at 12:59 pm
Author Comment
Comment by Klaus, June 16th, 2007 at 8:34 pm
Comment by Craig, June 18th, 2007 at 5:06 pm
Comment by Jay, June 18th, 2007 at 9:19 pm
Author Comment
Comment by Klaus, June 18th, 2007 at 11:26 pm
Comment by Jay, June 19th, 2007 at 1:58 pm
Comment by djot, July 9th, 2007 at 1:38 pm
Comment by Graeme D, July 9th, 2007 at 2:00 pm
Author Comment
Comment by Klaus, July 9th, 2007 at 3:18 pm
Author Comment
Comment by Klaus, July 9th, 2007 at 9:49 pm
Comment by Ali, July 11th, 2007 at 8:35 pm
Comment by djot, July 12th, 2007 at 9:46 pm
Comment by Frank Chau, July 13th, 2007 at 9:42 am
Author Comment
Comment by Klaus, July 13th, 2007 at 9:47 am
Comment by Steven K., July 17th, 2007 at 6:58 pm
Pingback by IE not letting innerfade and tab jquery work - DesignersTalk, July 18th, 2007 at 9:23 pm
Pingback by links not working in IE, July 18th, 2007 at 9:55 pm
Comment by Loren, July 19th, 2007 at 2:50 am
Comment by Matt, July 19th, 2007 at 4:11 am
Author Comment
Comment by Klaus, July 19th, 2007 at 2:01 pm
Comment by Magnus, July 20th, 2007 at 12:38 pm
Comment by Magnus, July 20th, 2007 at 12:46 pm
Author Comment
Comment by Klaus, July 20th, 2007 at 10:53 pm
Comment by Loren, July 22nd, 2007 at 1:13 am
Comment by Karthik, July 25th, 2007 at 3:13 pm
Comment by Magnus, July 25th, 2007 at 3:18 pm
Comment by Lars, August 2nd, 2007 at 9:26 am
Comment by mari, August 3rd, 2007 at 7:25 pm
Comment by Webcrawler Sam, August 3rd, 2007 at 10:39 pm
Author Comment
Comment by Klaus, August 4th, 2007 at 1:37 pm
Comment by mari, August 6th, 2007 at 2:36 pm
Comment by skc, August 6th, 2007 at 4:52 pm
Author Comment
Comment by Klaus, August 7th, 2007 at 1:32 pm
Comment by Karthik, August 11th, 2007 at 3:59 pm
Author Comment
Comment by Klaus, August 11th, 2007 at 7:08 pm
Comment by Diin, August 15th, 2007 at 4:10 am
Author Comment
Comment by Klaus, August 15th, 2007 at 12:07 pm
Comment by Korijn, August 17th, 2007 at 9:22 am
Pingback by 겸손한 탭 메뉴 구현 - Hooney.net, August 20th, 2007 at 6:19 am
Comment by Dirk Paessler, August 21st, 2007 at 4:18 pm
Comment by Roland, August 23rd, 2007 at 7:14 am
Comment by Roland, August 23rd, 2007 at 7:52 am
Comment by Ravenel, August 23rd, 2007 at 7:54 am
Comment by Swieczkos, August 24th, 2007 at 6:02 pm
Comment by Swieczkos, August 24th, 2007 at 6:03 pm
Comment by Swieczkos, August 24th, 2007 at 6:05 pm
Comment by JC, August 27th, 2007 at 4:59 pm
Comment by alf, August 28th, 2007 at 5:49 am
Comment by losted, September 6th, 2007 at 9:54 pm
Author Comment
Comment by Klaus, September 7th, 2007 at 6:05 pm
Comment by Quincy Glenn, September 8th, 2007 at 8:59 pm
Comment by Amy, September 11th, 2007 at 3:37 am
Author Comment
Comment by Klaus, September 11th, 2007 at 10:00 am
Comment by Amit, September 11th, 2007 at 10:46 pm
Comment by Ryno, September 12th, 2007 at 5:14 am
Comment by Roland, September 12th, 2007 at 9:40 am
Author Comment
Comment by Klaus, September 12th, 2007 at 10:31 am
Comment by Roland, September 12th, 2007 at 10:53 am
Comment by Roland, September 12th, 2007 at 11:38 am
Author Comment
Comment by Klaus, September 12th, 2007 at 11:58 am
Comment by Roland, September 16th, 2007 at 4:47 pm
Comment by Roland, September 16th, 2007 at 4:50 pm
Pingback by jQuery Plugins | Cyberpunk網際叛客, September 17th, 2007 at 7:26 am
Comment by Essa Morty, September 20th, 2007 at 1:58 am
Comment by Soflete, October 3rd, 2007 at 3:33 pm
Comment by KAIE, October 5th, 2007 at 6:53 pm
Comment by Frank, October 16th, 2007 at 12:58 pm
Author Comment
Comment by Klaus, October 16th, 2007 at 4:43 pm
Comment by Norman Khine, October 17th, 2007 at 8:59 pm