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

  • Home
  • SEARCH
  • 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 9175809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:58:36+00:00 2026-06-17T16:58:36+00:00

I have this jQuery content switcher and it just switches between content with no

  • 0

I have this jQuery content switcher and it just switches between content with no effect. I’d like it to have a simple fade effect. What do I do to add it?

Here’s the fiddle and here’s the jQuery code.

$(function(){

    function contentSwitcher(settings){
        var settings = {
           contentClass : '.content',
           navigationId : '#navigation'
        };

        //Hide all of the content except the first one on the nav
        $(settings.contentClass).not(':first').hide();
        $(settings.navigationId).find('li:first').addClass('active');

        //onClick set the active state, 
        //hide the content panels and show the correct one
        $(settings.navigationId).find('a').click(function(e){
            var contentToShow = $(this).attr('href');
            contentToShow = $(contentToShow);

            //dissable normal link behaviour
            e.preventDefault();

            //set the proper active class for active state css
            $(settings.navigationId).find('li').removeClass('active');
            $(this).parent('li').addClass('active');

            //hide the old content and show the new
            $(settings.contentClass).hide();
            contentToShow.show();
        });
    }
    contentSwitcher();
});
  • 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-17T16:58:37+00:00Added an answer on June 17, 2026 at 4:58 pm

    Replace this:

        //hide the old content and show the new
        $(settings.contentClass).hide();
        contentToShow.show();
    

    With this:

        //hide the old content and show the new
        $(settings.contentClass).fadeOut(800, function() {
           contentToShow.fadeIn(800);
        });
    

    The .fadeOut() method accepts a callback as a parameter – it will call the function you supply after the fade is complete, which is the appropriate time (in my opinion) to start fading in the other content.

    You can set the speed of the fade by supplying a string ("fast" or "slow") or a number of milliseconds.

    Demo: http://jsfiddle.net/LjHfZ/8/

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

Sidebar

Related Questions

I have this JQuery function: function addSomeHTML() { $(#mysection).html(<div id='myid'>some content here</div>); } I
I have found and customized this JQuery script, which displays different content when different
I have this jquery function that works, except I need to add something. I
I have this jQuery which shows/hides content depending on the list item that's clicked.
I have created a jQuery content switcher . Generally, it works fine, but there
This is a very simple question I know, but I have this jQuery code
I have this jquery code which pushes the content down on click: <script> $(document).ready(function()
I have this jQuery carousel going: http://dougie.thewestharbour.com/wp-content/themes/dougie/slider.html It works pretty well right now but
I have this jquery: $('.tbl-link').click(function(){ $('.tbl-content').animate({ opacity: 'show', //height: '+=300px', marginTop: '330px' }, 1200).css({
I have this jQuery code that retrieves external content using ajax, without refereshing the

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.