How to Prevent A SlideDown Event When Mouse Move Back to Handler Element

How to Prevent A SlideDown Event When Mouse Move Back to Handler Element

Can you please take a look at This Demo and let me know how I can prevent/stop slidedown function when user move back the cursor to the handler element

For example if you mouse over Home the .tab-pane will slide down and if you move mouse from the .tab-pane to Home tab it will re slide down the content. What I need to detect if mouse is coming from associated .tab-pane do nothing


  • $('a[data-toggle="tab"]').hover(
    1.   function(e) {
    2.     $(this).parent().addClass('active');
    3.     var target = $(this).data("target");
    4.     $($(e.target).attr('href')).slideDown('slow');
    5.   },
    6.   function(e) {
    7.     $(this).parent().removeClass('active');
    8.     var target = $(this).data("target");

    9.     var targetId = target.replace('#', '');
    10.     var relatedTarget = $(e.relatedTarget);

    11.     if (relatedTarget.attr('id') === targetId) {
    12.       return;
    13.     }

    14.     $($(e.target).attr('href')).hide();
    15.   }
    16. );

    17. $('.tab-pane').hover(function(e) {}, function() {
    18.   $(this).slideUp('slow');
    19.   $('.nav-tabs li').removeClass('active');
    20. });