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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:58:31+00:00 2026-05-19T14:58:31+00:00

Hi im using this code for a list of links that have an animation

  • 0

Hi im using this code for a list of links that have an animation on their padding. I wanted when i clicked on it to keep that padding and not animate back to its original position. What i dont understand are two things. “if (!$(this)” that part of code and how when i dont have a class of current on any link does it find any? Thanks so much!

$(function() {
    $('#secondary_content_what_we_do li a').hover(function() {
        if (!$(this).hasClass("current")) {
            $(this).stop().animate({
                "paddingLeft": "10px"
            }, 400).addClass('column_hover');
        }
    }, function() {
        if (!$(this).hasClass("current")) {
            $(this).stop().animate({
                "paddingLeft": "0px"
            }, 'slow').removeClass('column_hover');
        }
    });

    $('#secondary_content_what_we_do a').click(function() {
        $('a').removeClass('column_active').removeClass("current");
        $(this).addClass('column_active').addClass("current");
        $('#secondary_content_what_we_do li a').trigger('mouseleave');
        var url = $(this).attr('href');
        $('#loading_content').hide().load(url).fadeIn(1000);
        return false;
    });
})

UPDATE
For some reason i cant comment. I understand now, but i dont have a class current in my css so i dont know how that line helps.

  • 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-19T14:58:31+00:00Added an answer on May 19, 2026 at 2:58 pm

    This statement:

    if (!$(this).hasClass("current"))
    

    Is doing several things. It’s wrapping the this variable (which in this case refers to the element that was hovered over) in a jQuery object (using $(...)), and then calling the hasClass(...) method on it, and then notting (!) the result. The statement reads “If the element that was hovered over does not have the class “current” then execute the code within the block“

    As for the second part of your question, I think you’re referring to this line:

    $('a').removeClass('column_active').removeClass("current");
    

    And how it works if the anchor selected doesn’t have a class of current. If the a element selected has no current class, the statement will have no effect (Please let me know if this isn’t what you’re asking).

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

Sidebar

Related Questions

I m un-animating a list using this code... function unanimate_li() { $li.filter(':last') .animate({ height:
I have a nested oredered list which i m animating using this code... var
I have a long list of links that I spit out using the below
I have a small html code base that produces a list of unique links,
I have a method that loops through a list and creates Links using the
I have a list of links and I am using the following code to
I'm using this code, and I get the stack trace that is listed below.
Not that I have time to discuss this properly to reach a conclusion and
I have some code that is using mechanize and a password protected site. I
Ok, I have this list layout that I use, and I want the list

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.