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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:38:51+00:00 2026-06-12T13:38:51+00:00

I have a span in my page once. I have used hover function to

  • 0

I have a span in my page once. I have used hover function to display a pop-up on mouse hover and hide that pop-up automatically once the mouse is moved away. My code is below and it works fine.

What i need is if i click on the span the pop-up should freeze and only if i close the pop-up it must close. But the hover should also work. I need both hover and click function to be worked simultaneously..

My code for hover:

$('td#' + parentElement).find('span.likes').hover(function (e) {
    topPos = e.pageY - ($('div#pop-up').height()) - 35;
    leftPos = e.pageX - ($('div#pop-up').width()) - 30;
    if (leftPos < 0) {
        leftPos = 10;
    }
    GetLikesList(json_row.value.task_id);
    $('div#pop-up').show().css('top', topPos).css('left', leftPos).appendTo('body');
    $('#mopopuptitle').html('People who liked this Request');
}, function () {
    $('div#pop-up').hide();
});

My code for click:

$('#' + parentElement).find('span.likes').click(function (e) {
    topPos = e.pageY - ($('div#pop-up').height()) - 35;
    leftPos = e.pageX - ($('div#pop-up').width()) - 30;
    if (leftPos < 0) {
        leftPos = 10;
    }
    GetLikesList(json_row.value.task_id);
    $('div#pop-up').show().css('top', topPos).css('left', leftPos).appendTo('body');
    $('#mopopuptitle').html('People who liked this Request');
    e.stopPropagation();
})

How to integrate both???

  • 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-12T13:38:52+00:00Added an answer on June 12, 2026 at 1:38 pm

    You can use .on() to bind multiple events:

    $('#' + parentElement).find('span.likes').on('mouseenter click', function(e) {
        topPos = e.pageY - ($('div#pop-up').height()) - 35;
        leftPos = e.pageX - ($('div#pop-up').width()) - 30;
    
        if (leftPos < 0) {
            leftPos = 10;
        }
    
        GetLikesList(json_row.value.task_id);
    
        $('div#pop-up').show().css({
            top: topPos,
            left: leftPos
        }).appendTo('body');
    
        $('#mopopuptitle').html('People who liked this Request');
    }).on('mouseleave', function () {
        $('div#pop-up').hide();
    });
    

    Although I don’t see much use in binding both unless you want to run the handler twice. To click on the element, the mouse has to hover over it.

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

Sidebar

Related Questions

I have WPF Span that is used as a source to a TextBlock. I
I have a login popup that will pop up on every page of my
I have the following page structure: <span>content01</span> <span>content02</span> <span>content03</span> <br/> <span>content04</span> <span>content05</span> <span>content06</span> <br/>
I have an ASP.NET 3.5 page which has multiple span elements with ID containing
a I have some images on page and I want to put <span> tag
I have this at the bottom of my page: <form id=Login method=post runat=server> <span
I have the following code in a php page <div class=vmenu> <div class=first_li><span >Add
Lets assume I have several <span class='remove-type'> elements on a page. In jQuery document.ready
I have a javascript code that have span tag and inside the span tag
I have a form that once you select from a drop-down list and select

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.