Tabbed Content with Navigation using jQuery UI

This is a manual navigation using Tab function of jQuery UI library.

jQuery Library

jQuery UI

We will use jQuery UI Tab function to get our navigation for content slide working yeah there are many ways to do this but i just wanted to show you that we can done content slide with jquery UI too.


Step 1 : XHTML

So here first of all we need to wirte XHTML codes which holds all our elements. Here we need one main div (#main) which holds all our elements together in this, then navigation for content to slide(#nav). And in last we need 3 content holders with different ids (For example #1, #2, #3). Check out below codes for more clarification.

Step 2 : Styling With CSS

Now we have our raw XHTML codes with us.. so its the time to style all our html elements. First we will set fixed height and width, background image and don’t forget to apply position relative.

/* Which hides the inactive content slide */
.ui-tabs-hide {
display: none;
a {
#main {
#tabcontent {
position: absolute;
bottom: 30px; left:30px;
z-index: 100;
text-align: center;
line-height: 30px;
border: 1px solid #000;
background-color: #fff;
border: 1px solid #000;
ul.nav {
position: absolute;
bottom: 30px; left:30px;
ul.nav li {
.nav li {
.nav li p {

Note : Style Individual Content(#1,#2,#3) according to your requirement.

Step 3 : Jquery Time

We have our jQuery and jQuery UI library with us so will link both the files in head section of xhtml document. Also link one blank code.js file to xhtml document which holds all our codes in it.

Now here will use tab property of jQuery UI to get working our content slider. Will set height of active content to fadeOut when another navigation tab clicked and as soon as the inactive link clicked active content would be fadeout and opacity of clicked navigation links visibility toggles to get the desired effect. Check out below codes.

$(document).ready(function() {
$('#main > ul').tabs({ fx: { height: 'fadeOut', opacity: 'toggle' } });

So now everything has been done just last thing is remaining. Here we want when mouse hover on Navigation then one Small image will pop up just to show the overview of the content which has to be displayed when that hovered link will clicked. Check out the screenshot just to understand what i am trying to say.So to do this we will right jQuery codes to get it working. Here we will use variable offsetX and offsetY to to decide the position of popup image, then will select the particular navigation link and append the small popup image to it. Before writing jquery code add basic css property to style.css

#popimg {
position: absolute;

Check out the below codes to get it working. Read comments for better understanding.

$(function() {
//Set the position of small popup image
var offsetX = -20;
var offsetY = -100;
//Select the element of navigation
$('ul.nav li:first').hover(function(e) {
//Insert image         
$('big image')
//Set css property to #popimage using .css 
.css('top', e.pageY + offsetY)
.css('left', e.pageX + offsetX)
}, function() {
//Hide Popup when mouseout 

$('ul.nav li:first').mousemove(function(e) {
$("#popimg").css('top', e.pageY + offsetY).css('left', e.pageX + offsetX);




Be Sociable, Share!

Leave a comment