jquery - Apple.com 搜索棒点击后会变大?

标签 jquery css search

是否有人能够指出“类似”jquery 插件的正确方向,例如,可以复制苹果新的搜索棒功能?

使用 Safari 或 Chrome 时,位于苹果全局导航中的搜索棒在点击时会增大。我想在我的元素中加入同样的效果。

链接:http://www.apple.com/about/webbadges/

感谢您的帮助!

埃文

最佳答案

我想说的是你自己写吧!这并不像你想象的那么难。这可能有助于您入门:

<html><body>

<style>
#search {
    background-color: #999;
    width: 100px;
    border: 1px solid #ddd;
    outline: none;
}
</style>

<input id="search" />

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
<script>
jQuery(function() {
    jQuery('#search').focus(function() {
        jQuery(this).animate({ width: '200px', backgroundColor: '#fff' });
    }).blur(function() {
        jQuery(this).animate({ width: '100px', backgroundColor: '#999' });
    });
});
</script>

</body></html>

关于jquery - Apple.com 搜索棒点击后会变大?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5124845/

相关文章:

javascript - 触发附加元素上的现有事件

jquery - 请解释 jQuery 拖动的这种奇怪行为(在 Chrome 中)

javascript - replaceWith & fadeIn/fadeOut - 悬停之后不起作用

css - 如何使用位置 css 放置这个正确的位置?

search - Elasticsearch:在列表中搜索字段 null OR

javascript - 我需要向 Google map api 添加许多标记,并使用 Prompt() 添加注释

javascript - jQuery 一页导航 : highlight bug

javascript - 使用 jQuery 安全地设置页面样式具有丑陋的加载外观

search - 如何使我们的网站在谷歌搜索结果中名列前十?

javascript - 检查值范围是否在数组中