Is there a NOT (window).scroll function in jQuery? -


i'm trying set function stops working when user scrolls, there oposite function below?

 $(window).scroll(function() {      //while user not scrolling  }); 

here's function want stop working when user scrolls have multiple instances of using data rows, problem i'm having when 1 tooltip starts loading , user scrolls on several more accident or chance, page jumps last 1 load.

this function in on page load:

var targets = $( '[rel~=tooltip]' ), target = false, tooltip = false, title = false;

targets.bind( 'mouseenter', function() {     target  = $( );     tip     = target.attr( 'title' );     tooltip = $( '<div id="tooltip"></div>' );      if( !tip || tip == '' )         return false;      target.removeattr( 'title' );     tooltip.css( 'opacity', 0 )            .html( tip )            .appendto( 'body' );      var init_tooltip = function()     {         if( $( window ).width() < tooltip.outerwidth() * 1.5 )             tooltip.css( 'max-width', $( window ).width() / 2 );         else             tooltip.css( 'max-width', 500 );          var pos_left = target.offset().left + ( target.outerwidth() / 2 ) - ( tooltip.outerwidth() / 2 ),             pos_top  = target.offset().top - tooltip.outerheight() - 20;          if( pos_left < 0 )         {             pos_left = target.offset().left + target.outerwidth() / 2 - 20;             tooltip.addclass( 'left' );         }         else             tooltip.removeclass( 'left' );          if( pos_left + tooltip.outerwidth() > $( window ).width() )         {             pos_left = target.offset().left - tooltip.outerwidth() + target.outerwidth() / 2 + 20;             tooltip.addclass( 'right' );         }         else             tooltip.removeclass( 'right' );          if( pos_top < 0 )         {             var pos_top  = target.offset().top + target.outerheight();             tooltip.addclass( 'top' );         }         else             tooltip.removeclass( 'top' );          tooltip.css( { left: pos_left, top: pos_top } )                .animate( {opacity: 1 }, 50 );     };      init_tooltip();     $( window ).resize( init_tooltip );      var remove_tooltip = function()     {         tooltip.animate( { opacity: 0 }, 50, function()         {             $( ).remove();         });          target.attr( 'title', tip );     };      target.bind( 'mouseleave', remove_tooltip );     tooltip.bind( 'click', remove_tooltip ); });  $('.propavailable').hover(function(){      if ($(this).attr("title") == "") {         $(this).siblings("a.typesofproperties").click();     } }); 

targets.on( 'mouseenter', dostuff);  function dostuff() {     target  = $( );     tip     = target.attr( 'title' );     tooltip = $( '<div id="tooltip"></div>' );     ......etc }  var timer;  $(window).on('scroll', function() {     cleartimeout(timer);     targets.off( 'mouseenter', dostuff);     timer = settimeout(function() {         targets.on( 'mouseenter', dostuff);     },300); }); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -