"PS: maybe a dumb question but I'm pretty new to jquery"

Well, the solution doesn't really have anything to do with jQuery

instead of :

$(".classoflinks").hover(function() {
   $("#myDiv").show();
}, function() {
   setTimeout(function() { $("#myDiv").hide(); }, 4000);
});


this will hold the setTimeout in a later-accessible object

var _PendingHide;
$(".classoflinks").hover(function() {
   $("#myDiv").show();
}, function() {
   _PendingHide = setTimeout(function() { $("#myDiv").hide(); },
4000);
});


which in turn gives you the ability to cancel that "hide()" command

if (_PendingHide) { clearTimeout(_PendingHide ); }



On Dec 5, 7:55 am, Matthias Coy <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I have a relativly simple question, first some code:
>
> $(".classoflinks").hover(function() {
>    $("#myDiv").show();}, function() {
>
>    setTimeout(function() { $("#myDiv").hide(); }, 4000);
>
> });
>
> so that's what I'm doing. Mouseover shows the div, mouseout hides the
> div after 4 seconds. Now the tricky part:
>
> When I hover over the shown div, I want to stop the hiding. Something like:
>
> $("#myDiv").hover(function(){
>    $(this).stopHide();}, function() {
>
>    setTimeout(function() { $("#myDiv").hide(); }, 4000);
>
> });
>
> what do I have to do instead of my not existing function "stopHide()"?
>
> Sincerely
>         Matthias
>
> PS: maybe a dumb question but I'm pretty new to jquery.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery (English)" group.
To post to this group, send email to jquery-en@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to