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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:50:58+00:00 2026-06-13T09:50:58+00:00

I have create a very small jQuery plugin, for personal usage, that creating an

  • 0

I have create a very small jQuery plugin, for personal usage, that creating an overlay on top of an image on hover event, and then animating two icons.

On mouse out it is animating the icons again, and then fade out the overlay.

While the animation is fine, the problem comes with the icons. In too fast pass of the mouse animate – in – the icons but does not animate – out – the icons.

Here you can see a live example of what I mean: http://jsfiddle.net/merianos/yPerY/1/

Following the source code

HTML

<section class="clearfix span-10 last post_container ">
    <article>
        <div class="imageHover">
            <span class="overlay"></span>
            <a href="#" class="image_preview"></a>
            <a href="#" class="image_link"></a>
            <img src="http://goo.gl/YRC7G" />
        </div>
    </article>
</section>​

CSS

.post_container
{
    position : relative;
    margin   : 100px;
}

    .post_container article
    {
        position    :   relative;
        display     :   block;
        width       :   280px;
    }


        .post_container article img
        {
            width   :   278px;
            border  :   1px solid #dfe1e0;
        }

            .post_container article .overlay
            {
                z-index     :   740;
                display     :   block;
                width       :   100%;
                height      :   121px;
                background  :   #000;
                opacity     :   0;
                position    :   absolute;
                top         :   0;
                left        :   0;
            }


            .post_container article .image_link,
            .post_container article .image_preview
            {
                display             :   block;
                width               :   32px;
                height              :   32px;
                position            :   absolute;
                cursor              :   pointer;
                z-index             :   741;
                top                 :   88px;
                opacity             :   0;
            }

            .post_container article .image_link
            {
                background :   #0AF;
                left       :   98px;
            }

            .post_container article .image_preview
            {
                background :   #F0A;
                left       :   150px;
            }​

JavaScript

;(
    function($)
    {
        $.fn.extend(
            {
                wplImageHover: function(options)
                {
                    this.defaultOptions = {};

                    var settings    =   $.extend({}, this.defaultOptions, options);
                    var image       =   null;

                    var methods =   {
                        init    :   function()
                        {
                            image.mouseenter(
                                function(e)
                                {
                                    var overlay = $(this).find('.overlay');

                                    overlay.stop().animate(
                                        {
                                            'opacity'   :   '0.25'
                                        },
                                        150
                                    );

                                    overlay.queue(
                                        function()
                                        {
                                            var image_preview   =   $(this).siblings('.image_preview');
                                            var image_link      =   $(this).siblings('.image_link');

                                            image_preview.stop().animate(
                                                {
                                                    'opacity'   :   1,
                                                    'top'       :   '44px'
                                                },
                                                150
                                            );

                                            image_link.stop().animate(
                                                {
                                                    'opacity'   :   1,
                                                    'top'       :   '44px'
                                                },
                                                150
                                            );

                                            $(this).dequeue();
                                        }
                                    );

                                    e.preventDefault();
                                }
                            ).mouseleave(
                                function(e)
                                {
                                    var image_preview   =   $(this).find('.image_preview');
                                    var image_link      =   $(this).find('.image_link');

                                    image_preview.stop().animate(
                                        {
                                            'opacity'   :   0,
                                            'top'       :   0
                                        },
                                        150
                                    );

                                    image_link.stop().animate(
                                        {
                                            'opacity'   :   0,
                                            'top'       :   0
                                        },
                                        150
                                    );

                                    image_link.queue(
                                        function()
                                        {
                                            var overlay   =   $(this).siblings('.overlay');

                                            overlay.stop().animate(
                                                {
                                                    'opacity'   :   0
                                                },
                                                150
                                            );

                                            overlay.queue(
                                                function()
                                                {
                                                    $(this).css(
                                                        {
                                                            'opacity'   :   '0'
                                                        }
                                                    );

                                                    $(this).siblings('.image_link, .image_preview').css(
                                                        {
                                                            'opacity'   :   '0',
                                                            'top'       :   '88px'
                                                        }
                                                    );

                                                    $(this).dequeue();
                                                }
                                            );

                                            $(this).dequeue();
                                        }
                                    );

                                    e.preventDefault();
                                }
                            );
                        }
                    }

                    return this.each(
                        function()
                        {
                            image = $(this);

                            methods.init();
                        }
                    );
                }
            }
        );
    }
)(jQuery);

$('.imageHover').wplImageHover();​

Can anybody help me please ?

Kind regards
Merianos Nikos

  • 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-13T09:50:59+00:00Added an answer on June 13, 2026 at 9:50 am

    Demo JSFiddle

    In mouseleave event before applying top and opacity to the images using CSS stop the animation that is happening on those images. Otherwise it will override the CSS that you are applying (Only if the animation is happening while applying CSS). In case while we move very fast the animation that you are applying in mouse enter is happening. So this causes the issue.

    So try the below script.

    ;(
    function($)
    {
        $.fn.extend(
            {
                wplImageHover: function(options)
                {
                    this.defaultOptions = {};
    
                    var settings    =   $.extend({}, this.defaultOptions, options);
                    var image       =   null;
    
                    var methods =   {
                        init    :   function()
                        {
                            image.mouseenter(
                                function(e)
                                {
                                    var overlay = $(this).find('.overlay');
    
                                    overlay.stop().animate(
                                        {
                                            'opacity'   :   '0.25'
                                        },
                                        150
                                    );
    
                                    overlay.queue(
                                        function()
                                        {
                                            var image_preview   =   $(this).siblings('.image_preview');
                                            var image_link      =   $(this).siblings('.image_link');
    
                                            image_preview.stop().animate(
                                                {
                                                    'opacity'   :   1,
                                                    'top'       :   '44px'
                                                },
                                                150
                                            );
    
                                            image_link.stop().animate(
                                                {
                                                    'opacity'   :   1,
                                                    'top'       :   '44px'
                                                },
                                                150
                                            );
    
                                            $(this).dequeue();
                                        }
                                    );
    
                                    e.preventDefault();
                                }
                            ).mouseleave(
                                function(e)
                                {
                                    var image_preview   =   $(this).find('.image_preview');
                                    var image_link      =   $(this).find('.image_link');
    
                                    image_preview.stop().animate(
                                        {
                                            'opacity'   :   0,
                                            'top'       :   0
                                        },
                                        150
                                    );
    
                                    image_link.stop().animate(
                                        {
                                            'opacity'   :   0,
                                            'top'       :   0
                                        },
                                        150
                                    );
    
                                    image_link.queue(
                                        function()
                                        {
                                            var overlay   =   $(this).siblings('.overlay');
    
                                            overlay.stop().animate(
                                                {
                                                    'opacity'   :   0
                                                },
                                                150
                                            );
    
                                            overlay.queue(
                                                function()
                                                {
                                                    $(this).css(
                                                        {
                                                            'opacity'   :   '0'
                                                        }
                                                    );
    
                                                    $(this).siblings('.image_link, .image_preview').stop().css(
                                                        {
                                                            'opacity'   :   '0',
                                                            'top'       :   '88px'
                                                        }
                                                    );
    
                                                    $(this).dequeue();
                                                }
                                            );
    
                                            $(this).dequeue();
                                        }
                                    );
    
                                    e.preventDefault();
                                }
                            );
                        }
                    }
    
                    return this.each(
                        function()
                        {
                            image = $(this);
    
                            methods.init();
                        }
                    );
                }
            }
        );
    }
    )(jQuery);
    
    $('.imageHover').wplImageHover();​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a very basic sprite image. First off i have
I'm looking to create a very small cataloguing app for personal use (although I'd
I need to create a very small ListView. Each row could have a different
I have to create a small website (about 10 pages) with a very small
I have to create a small website (about 10 pages) with a very small
I have a small (very small) zend project that covers two modules, the admin
I currently have a very basic JQuery script accompanied by some CSS that helps
I'm using Backstretch jQuery plugin to create full screen background images, but have a
I have a very small VS2008 Winforms project that will not start. When I
As I hover a small img, I read it's larger image attribute, and create

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.