How can i set up a jQuery function that, when the user moves the mouse out of a div, will detect whether an input within the div is in focus and then change the div's opacity if it is not in focus?
So far I have tried using this code:
$("#navbar").mouseout(function(event){
if $(#navbarsearch.is( ":focus" )){
//Animation Complete
} else {
$("#navbar").css('opacity', '0.8');
}
});
Using is(":focus") to determine if the input is focused should do the trick.
$('#div').on('mouseleave', function() {
if($('input').is(":focus")) {
$('input').fadeTo(duration, opacity);
}
});