0

我试过没有动画的焦点,它的工作很完美。像这样:

document.forms['search_form'].elements['search'].focus()

我想做的事?:

I am using Animation (Which is working Perfect). So how can i set Focus into 
the **textfield** with Animation.

这样做的目的:

So that i dont have to click into the textfield for typing anything in it.

这是我的代码演示:

http://jsfiddle.net/HBgwx/3/

4

1 回答 1

1
$('a').click(function(){
    $('html, body').animate({
        scrollTop: $('#search').offset().top
    }, 500);
    $("#search").focus();
    return false;
});

JSFIDDLE 演示

于 2013-09-14T10:10:54.693 回答