【问题标题】:OnClick focus in Textfield with animation带有动画的文本字段中的 OnClick 焦点
【发布时间】:2013-09-14 10:04:21
【问题描述】:

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

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/

【问题讨论】:

    标签: jquery animation onclick focus textfield


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

    JSFIDDLE DEMO

    【讨论】:

    • 现在我正在从上到下滚动。从下到上滚动时该怎么办?
    猜你喜欢
    • 1970-01-01
    • 2019-02-28
    • 2010-11-09
    • 1970-01-01
    • 1970-01-01
    • 2020-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多