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

The Archive Base Latest Questions

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

I have a sidebar which expands on hover. Because expanding, collapsing can disturb sometimes

  • 0

I have a sidebar which expands on hover.

Because expanding, collapsing can disturb sometimes I want to unbind the hovering when someone clicks on the sidebar.

The code at the bottom works for unbinding the first time but the second click to reenable the hovering again doesn’t work:

    $('.action').click(function(){
        $(this).unbind('mouseenter').unbind('mouseleave');
        $(this).click(function(){
            $(this).bind('mouseenter').bind('mouseleave');
        });
    });

So how can I bind the hovering again when locked (please no if construction).

Regards

  • 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:02:46+00:00Added an answer on June 4, 2026 at 4:02 am
    $('.action').on('mouseenter mouseleave', doStuffOnHover); //initial handler
    
    var bound = true;
    
    $('.action').on('click', function(){
          $(this)[bound ? 'off' : 'on']('mouseenter mouseleave', doStuffOnHover);
          bound=bound ? false:true;
    });
    
    function doStuffOnHover() {
       //do stuff here
    }
    

    FIDDLE

    If doing different things on mouseenter/leave, you will of course need two functions.

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

Sidebar

Related Questions

I want to have 4 links in the sidebar of master page which every
I have developed a windows sidebar gadget which plays videos in a flash player,
I have a sidebar that I want to behave like it's frozen on the
I have a #sidebar (which starts below my #header div) and a #footer (around
I have a sidebar defined in my main layout which most of the time
on my website I have a sidebar panel, which has two tabs that when
For instance, i want to have my sidebar to have several dynamic content. Using
Hi I have a simple sidebar inside a div which has height:100% and I
I'm trying to make a sidebar which on a website which will have a
I have a category navigation in the wordpress sidebar which contains two main categories

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.