开发者

how can i trigger event when hidden div get focus in jQuery?

In a tabb design If there are multiple hidden div how can i trigger event when hidden div get focus using jquery. I tried "focus" but tha开发者_开发技巧ts for form controls. please suggest


You could supply a callback to the show() method, provided you are the one making that call.

$('#tab1').show('fast', function(){
    // do something now that it is showing
});


It is difficult to focus hidden field. But I suggest to use opacity as alternative if your existing DIVs code is editable. You can do it something like this:

HTML:

<div id="hiddendiv" style="height:'200';width:'200'">This is hidden DIV</div>

jQuery:

$('#hiddendiv').stop().animate({ opacity: 0.0 }, 500);

$('#hiddendiv').live('mouseenter', function(){
    $('#hiddendiv').stop().animate({ opacity: 1.0 }, 500);
});

Demo

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜