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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:40:45+00:00 2026-06-14T14:40:45+00:00

I have the following function I have written which is partially working. The mouse

  • 0

I have the following function I have written which is partially working. The mouse enter on hover animation is not working however the mouse leave animation is. As far as I can tell from the documentation it is written correctly but I can’t see what’s wrong. Any ideas? 🙂

function hoveranim (){

        $(this).hover(function() {

             $(this).animate({left: '+=260px'}, '6000');

        },

        function() {

            $(this).animate({left: '-=260px'}, '6000');

             }
         )};

        $('div#feedback-form-container').on('hover', hoveranim);
  • 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-14T14:40:46+00:00Added an answer on June 14, 2026 at 2:40 pm

    You are calling your function on the hover event. That means that once the hoveranim() function is coming into effect, the hover event has already passed, meaning it will not work, while mouseout will.

    I suggest you rewrite it to a function that extends jQuery (which also allows for chaining, might come in handy)

    jQuery.fn.hoveranim = function () {
        $(this).hover(function() {
             $(this).animate({left: '+=260px'}, '6000');
    
        },
        function() {
            $(this).animate({left: '-=260px'}, '6000');
             }
         )};
    

    Then bind to it like this, in the document ready event (‘$(document).ready)

    $('div#feedback-form-container').hoveranim();
    

    See this Fiddle for a demo.

    PS: note that when you animate the element to move, you automatically trigger the mouseout event as you are moving the element away from beneath the cursor. See my fiddle for that (potentially unwanted) effect.

    To circumvent that, I would suggest introducing a second element, which will remain static, preferably is invisible (though it should still be a block element) and is positioned above the element to be moved. Then rewriting the function to accept an optional elem parameter, specifying the element which is to be moved when this element is hovered.

    I have worked this out in another Fiddle (and here it is with an invisible hover_check)

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

Sidebar

Related Questions

I have written following function which checks whether start_date field is not empty and
i have the following function written in javascript which operate a slide up/down box.
I have written the following function which adds an event listener and registers the
i have written following function in JS which is called on click of some
I have written the following function which finds all divisors of a given natural
I have the following php function which i wrote a while ago. Now however,
I have written the following function but it's isn't returning anything when I run
I have written the following algorithm in order to evaluate a function in MatLab
I have the following function in a PHP script, which returns and API call:
Friends, I have written the following JavaScript to ascertain which row of an tabular

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.