Advertisement
Guest User

Untitled

a guest
Feb 12th, 2020
843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $( '[data-toggle="tooltip"]', '.office-map' ).on( 'shown.bs.tooltip', function ( e ) {
  2.     var targetElem = $( e.target ),
  3.         tooltipID = targetElem.attr( 'aria-describedby' ),
  4.         tooltipElem = $( '#' + tooltipID ),
  5.         tooltipTimeout;
  6.    
  7.     targetElem.on( 'mouseenter', function() {
  8.         $( this ).addClass( 'hover' );
  9.         clearTimeout( tooltipTimeout );
  10.     } );
  11.     targetElem.on( 'mouseleave', function() {
  12.         $( this ).removeClass( 'hover' );
  13.     } );
  14.     tooltipElem.on( 'mouseenter', function() {
  15.         $( this ).addClass( 'hover' );
  16.         clearTimeout( tooltipTimeout );
  17.     } );
  18.     tooltipElem.on( 'mouseleave', function() {
  19.         $( this ).removeClass( 'hover' );
  20.         tooltipTimeout = setTimeout( function() {
  21.             targetElem.tooltip( 'hide' );
  22.         }, 200 );
  23.     } );
  24.     targetElem.on( 'hide.bs.tooltip', function( e ) {
  25.         if ( tooltipElem.hasClass( 'hover' ) || targetElem.hasClass( 'hover' ) ) {
  26.             e.preventDefault();
  27.         }
  28.     } );
  29. } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement