开发者

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

开发者 https://www.devze.com 2023-01-18 08:06 出处:网络
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

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

精彩评论

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