将fadeIn()值转换为输入字段,如何? [英] fadeIn() value into an input field, how?

查看:48
本文介绍了将fadeIn()值转换为输入字段,如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读有关如何将值淡入输入字段的SA的问题的几个答案。当我尝试代码时,它不起作用。我尝试了几件事但仍然没有运气:

I have been reading several answers to questions here on SA about how to fade a value into an input field. And when I try the code, it doesn't work. I've tried a couple of things but still no luck:

这里是jsfiddle http://jsfiddle.net/bLcszctz/1/

here is the jsfiddle http://jsfiddle.net/bLcszctz/1/

我试过了:

$('#workinggeo').click(function () {
    $('.working').fadeIn('slow', function () {
        $('.working').val('finding...');
    });
});

$('#workinggeo').click(function () {
     $('.working').val('finding...').fadeIn('slow');
});

运气不好,任何人都可以帮忙解决这个问题,如果可能的话。非常感谢。

with zero luck, can anyone help solve this please, if it's at all possible. Many thanks.

推荐答案

除了使用j08691描述的animate进程外,你还可以使用 CSS3转换

Besides using the animate process described by j08691 you can also use CSS3 transitions

浏览器兼容性图表

$('#workinggeo').click(function () {
    $('.working').val("finding...").addClass("show");
});

input.working {
    transition: color 1s;
    color:#FFF;
}
input.show {
    color:#000;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<table cellpadding="0" cellspacing="0" id="worksearch">
    <tr>
        <td>
            <input type="text" class="working">
        </td>
        <td>
            <div id="workinggeo">test</div>
        </td>
    </tr>

这篇关于将fadeIn()值转换为输入字段,如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆