mouseleave behavior after AJAX load
After attaching mouseleave event to <div> container and then loading a <form> to a child <div> using AJAX load method, the <div> container starts behaving like it has mouseout instead of mouseleave. ie, everytime I mouse over an <input> element, the <div> container fades out. I tried to unbind before load and then bind after load but still no dice. Here is some code:
HTML:
<div id="ftr-blurb">
<div id="ftr-blurbmid">
<div id="ftr-blurb-copy"></div>
</div>
</div>
JS:
function blurb_out () {
$( '#ftr-blurb' ).fadeOut ( 200 );
}
function blurb_content ( file ) {
$( '#ftr-blurb' ).unbind ( 'mouseleave' ), blurb_out );
$( '#ftr-blurb-copy' ).load ( file, function () {
$( '#ftr-blurb-copy' ).fadeIn ( 200 );
setTimeout ( blurb_bindmouseleave, 10 );
} );
}
function blurb_bindmouseleave () {
$( '#ftr-blurb' ).bind ( 'mouseleave', blurb_out );
}
Not really sure how to overcome this problem. Any suggestions? Thanks!!