Ok it seems ive stumbled on another JQuery problem but i think this is more off a browser problem. The code below seems to work fine in All browsers apart from IE7 & Opera
function inputs() {
$('#search').css({opacity: .25}).hoverIntent( function() {
$(this).stop(true,true).animate({opacity: 1}, 500 );
},
function() {
if(!$('#mod_search_searchword').is(':focus') ) {
$('#search').stop().delay(500).animate({opacity: .25}, 500 );
}
}
);
$('#search').focusout(function(){$(this).stop(true,true).animate({opacity: .25}, 500 );});
}
The effect is simple... I just want it so that once the search input field is hovered to raise its opacity then when its hovered out to revert back to original opacity, but开发者_开发百科 if the input field is active to not execute the hoverout till they focus out. But for some reason :focus doesnt seem to be recognised by opera or IE7. Is there a work around?
I did not find the :focus selector in the latest jQuery docs.
You have to extend jQuery to use this feature.Answered here
Try this out.
setTimeout(function() { document.getElementById('mod_search_searchword').focus(); }, 10);
or you can also use :active
精彩评论