当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Resize event does not fire in Firefox, but I need to handle focus when FancyBox is shown

问题描述:

I am working on a solution where I need to have the first input field selected when a fancybox is shown. I have tried reacting to the resize event, which works fine in IE but not in Firefox. Also tried reacting to the click event on the link that opens the box - but aparently this is too early so some other element steals focus afterwards. Any ideas??

网友答案:

use the onComplete callback:

$("#whatever").fancybox({
    onComplete: function() {
        $('#someTextBox').focus();
    }
});
分享给朋友:
您可能感兴趣的文章:
随机阅读: