Detect mouseover event over jquery ui datepicker -


i using form placed on div moves in , out of screen when hover on it. take effect use jquery .hover() event:

$('#formulario').hover(     function () {         $(this).stop().animate({'marginright':'-2px'},200);         },     function () {         $(this).stop().animate({'marginright':'-345px'},200);         }     ); 

the problem using jquery ui datepicker in form, , when move widget select date, div's mouseleave event executes , form moves out. have tried find way detect mouseenter event datepicker can't find way avoid this. here example of problem

the datepicker element created outside of div doesn't carry hover. created empty display not yet set "none", filled in contents of calendar when first appears, after set display: none hide.

so wanted check 2 situations, datepicker empty, or set display: none. wrapped around hide animation means div cannot hide while datepicker open:

if ($('#ui-datepicker-div').html() == '' || $('#ui-datepicker-div').css('display') == 'none') {     $(this).stop().animate({'marginright':'-345px'},200); } 

now there side effect of if open datepicker, click somewhere off pop-out div, closes datepicker doesn't slide div in. bit checks we're not on either datepicker or pop-out div , triggers un-hover action:

$(document).click(function () {     if ($("#formulario:hover, #ui-datepicker-div:hover").length == 0) {         $('#formulario').trigger('mouseout');     } }); 

now though, if datepicker fading out on click, wasn't yet display: none; mouseout didn't trigger hide. if isn't @ opacity: 1 must fading or hidden, changed if clause bit more to:

if ($('#ui-datepicker-div').html() == '' || $('#ui-datepicker-div').css('display') == 'none' || $('#ui-datepicker-div').css('opacity') < 1) {     $(this).stop().animate({'marginright':'-345px'},200); } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -