星空网 > 软件开发 > Java

jQuery+HTML5弹出创意搜索框层

效果体验:http://hovertree.com/texiao/jquery/26/

本效果适用于移动设备,可以使用手机等浏览效果。

代码下载:http://hovertree.com/h/bjaf/e14uccpw.htm

HTML代码如下:

 1 <!doctype html> 2 <html lang="zh"> 3 <head> 4 <meta charset="UTF-8"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> 7 <title>jQuery+CSS3创意搜索框特效 - 何问起</title> 8 <link rel="stylesheet" type="text/css" href="http://hovertree.com/texiao/jquery/26/css/default.css" /> 9 <!--必要样式-->10 <link rel="stylesheet" type="text/css" href="http://hovertree.com/texiao/jquery/26/css/search-form.css" />11 12 </head>13 <body>14 <div>15 <a href="http://hovertree.com/">首页</a> <a href="http://hovertree.com/texiao/">特效</a> <a href="http://hovertree.com/h/bjaf/sousuokuang.htm">原文</a>16 </div>17 <form onSubmit="submitFn(this, event);" name="yestop">18 <div class="search-wrapper">19 <div class="input-holder">20 <input type="text" class="search-input" placeholder="请输入关键词" name="hewenqi" />21 <input type="hidden" name="q" />22 <button class="search-icon" onClick="searchToggle(this, event);"><span></span></button>23 </div>24 <span class="close" onClick="searchToggle(this, event);"></span>25 <div class="result-container">26 27 </div>28 </div>29 </form>30 31 <script src='/images/loading.gif' data-original="http://hovertree.com/ziyuan/jquery/jquery-1.12.0.min.js" type="text/javascript"></script>32 <script type="text/javascript" src='/images/loading.gif' data-original="http://hovertree.com/texiao/jquery/26/js/hovertreesearch.js"></script>33 </body>34 </html>

 

其中hovertreesearch.js的代码如下:

 1 function searchToggle(obj, evt) { 2 var container = $(obj).closest('.search-wrapper'); 3  4 if (!container.hasClass('active')) { 5 container.addClass('active'); 6 evt.preventDefault(); 7 } 8 else if (container.hasClass('active') && $(obj).closest('.input-holder').length == 0) { 9 container.removeClass('active');10 // clear input11 container.find('.search-input').val('');12 // clear and hide result container when we press close13 container.find('.result-container').fadeOut(100, function () { $(this).empty(); });14 }15 }16 17 function submitFn(obj, evt) {18 var value = $(obj).find('.search-input').val().trim();19 20 var _html = "您搜索的关键词: ";21 if (!value.length) {22 _html = "关键词不能为空。";23 }24 else {25 window.open("http://cn.bi" + "ng.com/search?q=site%3Ahove" + "rtree.com " + value + "&hewenqi=yestop");26 _html += "<b>" + value + "</b>";27 }28 29 $(obj).find('.result-container').html('<span>' + _html + '</span>');30 $(obj).find('.result-container').fadeIn(100);31 32 evt.preventDefault();33 }

更多特效:http://www.cnblogs.com/roucheng/p/texiao.html




原标题:jQuery+HTML5弹出创意搜索框层

关键词:HTML

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

jowissa:https://www.goluckyvip.com/tag/21765.html
Joy Tao:https://www.goluckyvip.com/tag/21766.html
Joy Yang:https://www.goluckyvip.com/tag/21767.html
joyberryyoga:https://www.goluckyvip.com/tag/21768.html
Joybird:https://www.goluckyvip.com/tag/21769.html
邮件群发软件:https://www.goluckyvip.com/tag/2177.html
在古巴做游轮 古巴旅游项目:https://www.vstour.cn/a/363194.html
西藏旅游攻略自驾游需要多少天 去西藏旅游自驾游要多久时间:https://www.vstour.cn/a/363195.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流