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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:33:39+00:00 2026-05-26T23:33:39+00:00

I am attempting to add a class to an element contained within an Ajax-loaded

  • 0

I am attempting to add a class to an element contained within an Ajax-loaded page prior to it being displayed in the browser in jQuery. Here is my code:

$("#landing li.nav4 a").live('click', function() {
    $("#landing").fadeOut('slow', function(){
        $('#agency').load('assets/ajax/agency.html').fadeIn(function(){
            $("#agency-main nav li.nav1 a").addClass("nav1-on");
        });
    });
    return false;
});

What happens at the moment is the page is loaded, and then the class is added and there is a noticeable “flash” as the class (background image) is loaded.

Any ideas how to load the content, add the class, and then fadeIn, in that order?

  • 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-26T23:33:39+00:00Added an answer on May 26, 2026 at 11:33 pm

    I’m a jquery noob so this is more for my own learning – why not this?

    //make sure #agency is defaulted to display:none, or add a line to check this
    $("#landing li.nav4 a").live('click', function() {
      $('#agency').load('assets/ajax/agency.html', function() {
        $("#agency-main nav li.nav1 a").addClass("nav1-on"); 
      });
      $("#landing").fadeOut('slow', function(){
        $('#agency').fadeIn();
       });
      return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working with jquery and attempting to add a class to a table
I am attempting to add an update method to the Symbol class. class SymbolUpdate(s:
I'm attempting to add a group of controls to a page when a button
I'm attempting to add a method to a grails domain class, e.g. class Item
I'm attempting to reopen the String class in rails and add a bunch more
I'm attempting to add a property in a partial class to an entity framework
I'm attempting to add a class to a group of floated list items on
I am attempting to simply add a FilterInfo class to my FilterInfo collection. I'm
I am attempting make a simulator class that will use a Queue to add
So the situation is this: attempting to add a dropdown box using the jquery.multiselect

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.