Sunday, April 18, 2010

SharePoint Tab Web Part JQuery, Java, and CSS

I have been searching for a simple tab web part for SharePoint but mostly came up empty handed… I was looking for something that a user can easily drag and drop a web part onto a specific tab within the page. There are quite a few free tab web parts out there but most of them were not just quite what I wanted. I checked out the following Tab web part solutions.

  1. Easy Tabs: From Path To SharePoint
    • Pro: The tabs automatically take the name of the web part.
    • Con: There is no option to add more than one web part per tab, and the User Interface is not that intuitive.
  2. Zone Tabs: From MSDN
    • Pro: You have a lot of options for tab customization
    • Con: It’s a web part that you have to install on the server. From what I remember it’s not that easy to re-arrange the web parts on the page.

I finally found this article from Bits Of SharePoint Site:
http://www.bitsofsharepoint.com/ExamplePoint/Site/TabPage.aspx

His code was exactly what I needed. All I had to do was make a few adjustments of the HTML and create my own tab styles. The process to get this to work is you simply edit the page layout in the source link below (Code is already included in header control) and change the name of the tabs to what ever you want. You can have as many tabs as you want but if you go over 8 you will need to add more web part zones.

<li><a href="#tab-1" class="selected"><span>Tab1</span></a></li>
<li><a href="#tab-2" ><span>Tab2</span></a></li>
<li><a href="#tab-3" ><span>Tab3</span></a></li>

Once you have your tabs specified, simply choose what design you want. I created a few example designs that will get you started. To change the designs simply remove the commented out referenced style sheet and comment out the one you don’t want. You can place the support files anywhere you want but the links in the page layout point to the 12 hive: /_layouts/1033/styles/tabstyles/

For inspiration, I looked around the web and found a few unique styles that I wanted to replicate, and I also came up with a few of my own. Please download the Source Files HERE and give it a try!

Design 1: MSN
msntab

Design 2: Yahoo
yahootab

Design 3: WebMD
webmdtab

Design 3a: WebMD Alt
webmdalttab

Design 4: Rounded Tabs 1
roundtab

Design 5: Rounded Tabs 2
round2tab

Drop me a comment if you found this useful!

32 comments:

Girish said...

Awesome!

chrisBaird said...

You are reading my mind, circa 6 months ago :-)

rabih said...

great post.
but when i switch to another tab(ex:tab2) the same content in tab1 still appear in tab2.
i used it to display page content in each tab.

Anonymous said...

I found this site:(http://www.bitsofsharepoint.com/ExamplePoint/Site/TabPage.aspx)a while ago, because I had the same issue as you. The "Easy Tabs and Zone Tabs" are not realy what I wanted. Now when you implement the Tabs from Peter Allen. Do you have any trouble to navigate within Folders on a Document Library? I mean, imaging you uploaded documents within Folders. At this point, everytime you open a Folder, IE do a refresh and cannot remember his last session (Navigate automatically back to Tab1). Do you have a solution for my problem? This is the reason why I didn't use Peter Allen great Tab Template and I want to use it. =)

Peter Allen said...

Erik,

Nice work on the tabs, they look really good. I have updated my code so that tabs are sticky, so if you refresh the page it will stay on the tab vs. going back to the first tab.

View details here: http://www.bitsofsharepoint.com/ExamplePoint/Site/TabPage.aspx

The tab, Code Update, has the instructions and code changes.

Peter
www.bitsofsharepoint.com

Sean said...

Hi Erik,
Your information is helpful, but I found that I need to put additional webpart, and others might found the trick when edit the webparts, so I give it up. I am using JQueryUI now.

Hi Anonymous, I had the same problem as you do. That's why I use JQueryUI instead:
http://jqueryui.com/demos/tabs/
to deal with the cookies, check this link: http://stackoverflow.com/questions/2635998/jquery-sticky-tabs

Christophe said...

Erik,

I just came across your post and your comments about my Easy Tabs.
Could you elaborate on your comment that the UI is not intuitive? I am currently working on new versions and I am willing to make the Easy Tabs better.
Also, note that an essential benefit of the Easy Tabs is that there is no external dependency (jQuery or other).

Christophe said...

Quick update, a demo with styled Easy Tabs:
http://tinyurl.com/ET-CSS3

Cory said...

I'm currently the SharePoint 07 designer/admin for my company. I've had to learn Designer and SharePoint and am now looking for information on getting official training and certification. Can you provide any feedback on where to go for this and/or any useful websites to check out? I live in San Diego, CA btw. Appreciate any feedback. Thank you.
ccampbell2074@yahoo.com

Tim Farrell said...

Hi Eric,

Great post. Just what I need.

The problem I am having is that whenever I add a web part to the page I get the following error:

The SPListItem provided is not compatible with a Publishing Page

Are there any other modifications to the page that must be made or does the page have to be stored in a certain library to work?

Thank you for your response.

Sincerely,
Tim

Chetan said...

Does this work with SP 2010?

Ujwal Sardeshmukh said...

Does this work with SharePoint 2010?
If how then can you please tell me the Step By Step procedure to acheive this.

Jiehae said...

I am pretty new to SharePoint and had to figure out adding tabs to a page.
It worked beautifully! (@Chetan, we have SP 2010 and it worked!)

I just wanted to thank you for the awesome post.

One last thing.
I don't know how to apply the tab styles you posted. would you please tell me how to do it? or can you tell me what i should study to understand CSS?

thanks!

Erik Swenson said...

Jiehae, to get the other styles to show just remove the Comment Brackets from the references CSS files and then put those same comment marks to the one that you do not want to use and the style should work with a refresh of the page. Im glad you were able to get it to work on 2010. There should be no reason why it should not work.

Anonymous said...

Is this supported in SP2010?
Doesn't seem to fit fluidly on the page.

Anonymous said...

Hi

This worked beatifully for me ;-)

I have one issue though:
The standard left navigation is missing

Any suggestions

/ geert larsen

Jake said...

In our SharePoint projects we use a tool to customize SharePoint forms: Advanced Forms for SharePoint (http://www.kaldeera.com)

Hope this helps.

Jake

Damon Lueck said...

Hi Erik, thanks for the tabs, I use them all over the place. Im having one small issue though and Im hopeful you have a quick solution- When a page is first loaded, the first tabe that is coded for class 'selected' does show that it is selected, but it doesnt have any content until you click on it. I have changed the code via one of the other posts to "remember" which tab is selected after the first visit, and then the tab content shows. But on the first page load the content isnt displayed. Do you know why or where to fix this? Thanks

Anonymous said...

Great post.

I think you meant to say 'SharePoint Tab Web Part JQuery, Java*script*, and CSS.

Anonymous said...

THANK YOU! (I really meant to use Caps).

CHM said...

I tried to download the code for the tabs and it looks like it is a dead link?

Erik Swenson said...

CHM, I did not see any issue with the download. What type of computer and opperating system are you using?

Anonymous said...

a dam question: my tabs cannot show content. I changed href="/lists/mylist/allitems.aspx", but nothing happend.

Is there more steps to do?

Anonymous said...

a dum question: my tabs cannot show content. I changed href="/lists/mylist/allitems.aspx", but nothing happend.

Is there more steps to do?

Anonymous said...

ok, problem solved. I just manually add jquery.js link. when i click a tab, i see a webpart zoon correspondes the same tab.

Dona Deri said...

I want to get a vertical view for these tabs instead of horizontal. Will the content of each tab still show horizontally or will it change the entire view of the page if I were to change the tabs to show vertically (up/down)?

Domsen said...

how can i add more webpartzones for more than 8 tabs?

ANIL said...

Can someone say how we can add the tabs to existing page.

Harold Liles said...

I downloaded your sample syltes and tabpage.aspx, but I want the tabbed zone at the bottom of the page. Is it easy to move that around?

-Thanks

Jovix said...

This was very useful to me, however I'm trying to use it with calendar views and it does not seem to work right. The calendar in the first zone renders fine, however the calendars on the other forms don't render the events correctly. The calendar entries show up in the top left corner. Has anyone else encountered this and solved it?

aparna john said...

Hi,Moreover, clients need their personal and financial details to remain private. As a result, it is essential to consist of security on the website.If a website is an e-commerce website, make the purchasing bag or seek the Web Design Cochin services of someone to do it for you.Thanks....

Sqiar BI said...

Tableau Software Consultants
I work on our Professional Services team.We have Business Consultants that can help in several ways.Our Company Which is Located In London. Here are some of services that we offerhttp://www.sqiar.com/solu... Click on the link of that page to send us an email. We'd be happy to help. Professional Services Tableau Software