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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:21:45+00:00 2026-06-04T04:21:45+00:00

My function is triggering the second mouseleave() event rather than the first one, resulting

  • 0

My function is triggering the second mouseleave() event rather than the first one, resulting in nth-child(1) & nth-child(2) to have a .css property of bottom:99px when i want them to use the first mouseleave() event which sets the property to bottom:94px

I am fairly sure after some research that i need to close my (this) statement so that when i call it in for the second round of arguments it works within the new scope..?

$(document).ready(function(){

    $('#rows').on('mouseenter', "div.row div:nth-child(1), div.row div:nth-child(2)",this , function() {
        $('img',this).stop().animate({"bottom":"0px"}, "fast"); 
    });

    $('div',this).off("mouseleave").on("mouseleave", function() {
        $('img',this).stop().animate({"bottom":"94px"}, "fast");    
    }); 

// need closure here? 

    $('#rows').on('mouseenter', "div.row div:nth-child(3), div.row div:nth-child(4)",this , function() {
        $('img',this).stop().animate({"bottom":"0px"}, "fast"); 
    });

    $('div',this).off("mouseleave").on("mouseleave", function() {
        $('img',this).stop().animate({"bottom":"99px"}, "fast");    
    });
});
  • 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-04T04:21:45+00:00Added an answer on June 4, 2026 at 4:21 am

    I’m going to guess that you want this:

    $('#rows').on('mouseenter', "div.row div:nth-child(1), div.row div:nth-child(2)", this , function() {
        $('img', this).stop().animate({"bottom":"0px"}, "fast");
    
        // when placed inside, the value of this makes more sense?
        $('div', this).off("mouseleave").on("mouseleave", function() {
            $('img',this).stop().animate({"bottom":"94px"}, "fast");    
        }); 
    });
    

    In this statement that you wrote, the value of this is probably window, so $('div', this) would target all div on the page.

    $('div', this).off("mouseleave").on("mouseleave", function() {
        $('img',this).stop().animate({"bottom":"94px"}, "fast");    
    }); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

basically I have a function that resizes elements accordingly with jquery triggering the function
I have mouse actions triggering a custom function on the html and body, however
I am having issues triggering a jQuery click through Greasemonkey/Tampermonkey... jQuery('button').each(function() { jQuery(this).css('background', 'red');
I am triggering a mouse event on the map from an absolutely positioned dom
I would like to have a form triggering submit after a few seconds of
With a pulldown triggering an onchange event to submit, it fails to work when
I would like a way of detecting/triggering a function when the form onsubmit is
I'm having a problem triggering events on items that have been added to the
I have this function that gets the fileData as a byte array and a
I have this click listener and for some reason it's not triggering in IE8

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.