hover - jQuery: If Mouse Hovering When Page Loads… -


i'm having tricky time working through jquery issue. page has feature image. when user hovers on feature image, transparent overlay supporting content fades in, , if move mouse outside feature supporting bar fades out. far good, but…

i'd have transparent overlay fade in, hold few seconds, fade out when page loads (like sneak peak). pretty easy, thought. but, didn't consider function needs check see if mouse on feature area when page loaded. if is, support bar shouldn't fade out until user isn't hovering on feature area (e.g., initial auto fade out skipped). so:

  • page loads
  • if mouse isn't on feature area, show overlay, wait few secs, fade out
  • if mouse on feature area, show overlay, don't fade out until user leaves feature area
  • after initial run, anytime user on feature overlay fades in, when mouseout overlay fades out

i can't seem figure out clean way (i'd rather not have track mouse coords). ideas appreciated :)

here's page: http://collective.poccuo.com/

and here's have @ moment:

$(window).load(function(){       $('#content.homepage #support').show().delay(2000).fadeout(100,function(){         $('#content.homepage').hover(function(){             $("#content.homepage #support").delay(500).fadein(350);          },function(){             $("#content.homepage #support").fadeout(150);         });     });  }); 

i think should this:

   var hideinitially = true; //this var magic    $(window).load(function(){           $('#content.homepage').hover(function(){             $("#content.homepage #support").delay(500).fadein(350);             hideinitially= false; //if there has been hover, don't hide on load          },function(){             $("#content.homepage #support").fadeout(150);         });     $('#content.homepage #support').show();     settimeout(function(){ //same delay        if(hideinitially) $('#content.homepage #support').fadeout(100);  //only hide if there wasn't hover           }, 2000);  }); 

what code prevent initial hiding if there has been hover. hope helps. cheers


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -