2010-04-04 15 views
14

mój htmljquery mouseout problemem

<div id="parent"> 
<div id="child">cx</div> 
</div> 

gdy używam jQuery

$('#parent').mouseout(function(){ 
//something here 
}); 

zastanawiam się dlaczego, kiedy moja mysz wprowadzić dziecko div pożarów funkcyjnych. nadal jestem w div rodzica. chcę, że funkcja mouseout na ogień tylko kiedy wychodzę div nadrzędnej nie kiedy jestem na każdym div dzieci

http://jsbin.com/esiju/ < < przykład

Cheers

+0

Prawdopodobny duplikat: http://stackoverflow.com/questions/350639/how-to-disable-mouseout-events-triggered-by-child-elements –

Odpowiedz

1

.mouseleave prace doskonale tutaj:

$("#parent").mouseleave(function(){ 
    //Enter stuff that should happen when mouse leaves 
    //the boundaries of the parent element 
    // NOT including the children 
}); 

.mouseout pożary na mousing nad elementami dziecko!