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 7720493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:41:20+00:00 2026-06-01T03:41:20+00:00

I have a page that I am trying to make a generic style of

  • 0

I have a page that I am trying to make a generic style of tabs that this function will work with to basically hide all the tab content and reveal the one clicked on. It all works great except in Firefox where it is still firing off the default action and jumping the page when you click on the target. Oddly enough if you click on the one that is already open it doesn’t jump. In the example code there is just 2 tabs and sets of content but it could just as easy be more than that.

<div id="recentGalleryBox">
  <ul class="tabs">
    <li class="active"><a href="#recentVideo" title="latest videos">Latest Videos</a></li>
    <li class="last"><a href="#recentPhoto" title="latest photos">Latest Photos</a></li>
  </ul>
  <div class="tabsContent bgNone">
    <div id="recentVideo">
      <img src="http://i.ytimg.com/vi/Ymjh5ZV1H48/0.jpg" class="articleImage vidThumb" />      
      <p class="readmore"><a href="/galleries/videos" title="View all photos">View all video galleries</a></p>
    </div>  
    <div id="recentPhoto">
      <img src="/images/sized/dev/images/uploads/gallery/genericphoto-280x175.jpg" width="280" height="175"  alt="Album Image" class="articleImage" />
      <p class="readmore"><a href="/galleries/photos" title="View all photos">View all photo galleries</a></p>
    </div>
  </div>
</div>

$(document).ready(function(){
  $('#recentPhoto').hide();
  $('.tabs li a').click(function(e){
    var reveal = $(this).attr("href");
    var theid = ""
    $(this).parents('ul').children('li').removeClass('active');
    $(this).parent().addClass('active');
    $(this).parents('ul').next().children().each(function(idx, item){
      theid = "#"+$(item).attr("id");
      if (reveal != theid) {$(theid).hide();}
    });
    $(reveal).fadeIn();
    e.preventDefault();
  });
});
  • 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-06-01T03:41:21+00:00Added an answer on June 1, 2026 at 3:41 am

    Not related, but you are missing a semicolon

    var reveal = $(this).attr("href");
    var theid = ""
    

    — EDIT thanks @Interstellar_Coder for pointing that out 🙂
    no semicolon after theid, parser is smart enough to add in missing semi colons, but it’s good to stay consistent.

    The issue is when you call if (reveal != theid) {$(theid).hide();}, since the content basically only consists of that, the height of your whole document at one instance is 0 thus you perceive a “jumping” to the top caused by the click.

    If you have an enough space below #recentGalleryBox the issue is gone

    http://jsfiddle.net/B9M2k/14/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a function page that will open and close the
I have been trying to make a user login page that, when the user
I have been trying to make jquery datepicker plugin work on a content page
I'm trying to create a User show page (that will function as a profile
I'm trying to make a page that will accept a URL input by the
I have been trying to make this work for couple of days now, my
I have an extremely simple page that I'm trying to view in the Facebook
I have a page going here that uses jQuery: http://treethink.com/services What I am trying
I'm trying to make a page that shows how to enable JavaScript in various
I'm trying to make a web page that only has content within the page

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.