Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6982749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:19:46+00:00 2026-05-27T18:19:46+00:00

I’m using jQuery tabs to create a unique user interface for a project I’m

  • 0

I’m using jQuery tabs to create a unique user interface for a project I’m working on, and I’m having some trouble getting them to do what I need them to do.

The layout:
Layout

The years running along the top would be the tabs.

What I’m trying to do is this: when the user clicks one of the years, 2009 for example, that tab will slide over to become the center tab (along with its content), new tabs for preceding years will be added to the left, and excess tabs will be removed from the right. So in the end there will be the same number of tabs, with the selected year in the center.

I feel like my experience with jQuery is not adequate to accomplish this. How would I accomplish this sort of functionality?

Code so far:

$(function() {
    $( "#tabs" ).tabs({selected: 3});//just selects the center tab(probably needs to be changed)
    $( "#tabs" ).tabs({
           select: function(event, ui) {
                    var year = $(".year").val();
                    //figure how many tabs are left and right (year - selected year)
                    //delete and add tabs
                    //change class of selected tab
               }
        });
});

I’ve got a couple notes in there that are kind of an idea of the process as I though it might need to go.

<div class='navBar' id='tabs'>
<ul>
    <li class='navElement'><a href="post.php?year=<?php echo($year-3);?>"><?php echo($year-3);?></a></li>
    <li class='navElement'><a href="post.php?year=<?php echo($year-2);?>"><?php echo($year-2);?></a></li>
    <li class='navElement'><a href="post.php?year=<?php echo($year-1);?>"><?php echo($year-1);?></a></li>
    <li class='navFocus'><a href="post.php?year=<?php echo($year);?>"><?php echo($year);?></a></li>
    <li class='navElement'><a href="post.php?year=<?php echo($year+1);?>"><?php echo($year+1);?></a></li>
    <li class='navElement'><a href="post.php?year=<?php echo($year+2);?>"><?php echo($year+2);?></a></li>
    <li class='navElement'><a href="post.php?year=<?php echo($year+3);?>"><?php echo($year+3);?></a></li>
</ul>
<div id="tabs-1"></div>
<div id="tabs-2"></div>
<div id="tabs-3"></div>
<div  id="tabs-4"></div>
<div id="tabs-5"></div>
<div id="tabs-6"></div>
<div id="tabs-7"></div>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:19:47+00:00Added an answer on May 27, 2026 at 6:19 pm

    I would also skip jQuery UI Tabs. The actual tab functionality is not (by far) the biggest problem here.

    This is a start: http://jsfiddle.net/8aGC4/2/ but it’ll require some tweaking on your part. Hopefully it can get you started though.

    If the code isn’t clear enough feel free to ask!

    HTML

    <nav class="tabs">
        <ul>
            <li><a href="#year-2000">2000</a></li><li><a href="#year-2001">2001</a></li><li><a href="#year-2002">2002</a></li><li><a href="#year-2003">2003</a></li><li><a href="#year-2004">2004</a></li><li><a href="#year-2005">2005</a></li><li><a href="#year-2006">2006</a></li><li><a href="#year-2007">2007</a></li><li><a href="#year-2008">2008</a></li><li><a href="#year-2009">2009</a></li><li><a href="#year-2010">2010</a></li><li><a href="#year-2011">2011</a></li><li><a href="#year-2012">2012</a></li><li><a href="#year-2013">2013</a></li><li><a href="#year-2014">2014</a></li><li><a href="#year-2015">2015</a></li><li><a href="#year-2016">2016</a></li><li><a href="#year-2017">2017</a></li><li><a href="#year-2018">2018</a></li><li><a href="#year-2019">2019</a></li><li><a href="#year-2020">2020</a></li>
        </ul>
    </nav>
    
    <div class="tab-content">
        <div id="year-2000">2000 - Lorem ipsum dolor</div>
        <div id="year-2001">2001 - Lorem ipsum dolor</div>
        <div id="year-2002">2002 - Lorem ipsum dolor</div>
        <div id="year-2003">2003 - Lorem ipsum dolor</div>
        <div id="year-2004">2004 - Lorem ipsum dolor</div>
        <div id="year-2005">2005 - Lorem ipsum dolor</div>
        <div id="year-2006">2006 - Lorem ipsum dolor</div>
        <div id="year-2007">2007 - Lorem ipsum dolor</div>
        <div id="year-2008">2008 - Lorem ipsum dolor</div>
        <div id="year-2009">2009 - Lorem ipsum dolor</div>
        <div id="year-2010">2010 - Lorem ipsum dolor</div>
        <div id="year-2011">2011 - Lorem ipsum dolor</div>
        <div id="year-2012">2012 - Lorem ipsum dolor</div>
        <div id="year-2013">2013 - Lorem ipsum dolor</div>
        <div id="year-2014">2014 - Lorem ipsum dolor</div>
        <div id="year-2015">2015 - Lorem ipsum dolor</div>
        <div id="year-2016">2016 - Lorem ipsum dolor</div>
        <div id="year-2017">2017 - Lorem ipsum dolor</div>
        <div id="year-2018">2018 - Lorem ipsum dolor</div>
        <div id="year-2019">2019 - Lorem ipsum dolor</div>
        <div id="year-2020">2020 - Lorem ipsum dolor</div>
    </div>
    

    CSS

    body {
        font: 12px/1.2 Arial, sans-serif;
        color: #666;
    }
    
    nav.tabs {
        width: 630px;
        margin: 0 auto;
        overflow: hidden;
    }
    
        nav.tabs ul {
            margin: 0;
            padding: 0;
            list-style: none;
            white-space: nowrap;
        }
    
            nav.tabs ul li {
                display: inline-block;
                margin: 0;
                font-size: 0;
            }
    
                nav.tabs ul li a {
                    background: #f6f6f6;
    
                    display: block;
                    width: 58px;
                    padding: 5px;
    
                    color: #666;
                    text-align: center;
                    font-size: 12px;
    
                    border-left: 1px solid #fefefe;
                    border-right: 1px solid #f0f0f0;
                }
    
    div.tab-content {
        width: 210px;
        margin: 0 auto;
    }
    
        div.tab-content div {
            background: #f6f6f6;
            display: none;
            padding: 5px;
        }
    

    JS

    $(function () {
        var tabs = $('nav.tabs a');
        var tabContent = $('div.tab-content > div');
    
        tabs.click(function () {
            // Hide and deselect previous tab
            tabs.filter('.active').removeClass('active').animate({width: '58px'}, 100);
            tabContent.slideUp(100);
    
            // Select and show this tab
            var tab = $(this);
    
            tab.addClass('active').animate({width: '198px'}, 100);
            $(tab.attr('href')).slideDown(100);
    
            // Scroll tab container so that current tab is centered
            var currentTab = tabs.index(tab);
    
            // 3 = num tabs to the left of selected tab, 70 = width of tabs
            $('nav.tabs').scrollTo((currentTab - 3) * 70, {axis: 'x', duration: 100});
    
            return false;
        });
    
        $('a[href="#year-2014"]').click();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I am reading a book about Javascript and jQuery and using one of the
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.