仿淘寶TAB切換搜索框搜索切換的相關(guān)內(nèi)容
更新時間:2014年09月21日 10:22:23 投稿:whsnow
這是一款仿淘寶TAB切換搜索框,想搜索哪方面的內(nèi)容就切換到哪一個,非常實用,喜歡的朋友可以看看
一款仿淘寶TAB切換搜索框,想搜索哪方面的內(nèi)容就切換到哪一個,感興趣的朋友可以看看下面的代碼
<div class="search"> <div id="searchBox"> <ul class="tab-bar clearfix" id="tabBar"> <li class="current" tips="請輸入產(chǎn)品名稱">商品</li> <li class="tab-line"><span>|</span></li> <li tips="請輸入店鋪名稱">店鋪</li> </ul> <div class="tab-box clearfix" id="tabBox"> <form onsubmit="" action="" method="get" name="searchForm" id="searchForm" class="clearfix"> <input class="text" id="keyword" name="keyword" lang="zh-CN" type="text" value="請輸入產(chǎn)品名稱"> <input class="button" value="搜索" onfocus="this.blur()" type="submit"> </form> </div> </div> <div class="keyword"> <a href="#"><span>男裝</span></a> <a href="#"> 朵牧女鞋</a> <a href="#">圣高男鞋</a> <a href="#"><span>女裝</span></a> <a href="#">防曬霜</a> <a href="#">脫毛膏</a> </div> </div>
.search{ position: absolute; top:14px; left: 34%; width:477px; _width:477px; height: 81px;} .keyword a{ font-size: 12px; line-height: 18px; color:#999; padding:0 4px;} .keyword a span{ color:#fb5004;} .tab-bar li.current{ color: #1d7ad9; font-weight: bold; background: url(../images/trian_up.png) no-repeat center bottom; padding-bottom: 9px;} .tab-bar li{ width:38px; text-align: center; color: #444; float: left; cursor: pointer;} .tab-bar li.tab-line{ width: 2px; color: #c9c9c9; margin:0 2px;} .tab-box{ border:2px solid #1d7ad9;} .text{ color: #a9a9a9; width:376px; height: 31px; border:none; text-indent: 10px; float:left; outline: none; border:0;} .button{ width: 97px; height: 32px; text-align: center; color: #fff; font-size:18px; background: #1d7ad9; border:none; float: left;}
<script type="text/javascript"> $(function(){ // 搜索切換 $('#tabBar').on('click', 'li', function(){ var tips = $(this).attr('tips'); if(tips){ $(this).addClass('current').siblings().removeClass('current'); $('#keyword').val(tips); } }); </script>
相關(guān)文章
JavaScript用20行代碼實現(xiàn)虎年春節(jié)倒計時
春節(jié)將至,相信大家跟小編一樣很激動呀。為了迎接虎年春節(jié)到來,小編為大家準(zhǔn)備了一個虎年春節(jié)倒計時,僅20行代碼用js就實現(xiàn)啦。感興趣的可以動手試一試2022-01-01JavaScript將對象數(shù)組按字母順序排序的方法詳解
這篇文章主要介紹了JavaScript如何將對象數(shù)組按字母順序排序,本文介紹了三種解決方案,if條件語句 + sort(),localeCompare() + sort(),Collator() + sort(),有感興趣的同學(xué)可以跟著小編一起來看看2023-07-07使用JavaScript實現(xiàn)網(wǎng)頁版Pongo設(shè)計思路及源代碼分享
Pongo是款很好玩的手欠類游戲,由于在玩的過程中發(fā)現(xiàn)了一些BUG,所以就打算自己也弄個,經(jīng)過一番思索,就有了本文,主要說說實現(xiàn)這款游戲的設(shè)計思路以及分享源碼給大家2014-06-06Bootstrap學(xué)習(xí)筆記之css樣式設(shè)計(2)
這篇文章主要為大家詳細(xì)介紹了Bootstrap學(xué)習(xí)筆記之css樣式設(shè)計,感興趣的小伙伴們可以參考一下2016-06-06