zoukankan      html  css  js  c++  java
  • 仿淘宝TAB切换搜索框

     1 <div class="search">
     2         <div id="searchBox">
     3             <ul class="tab-bar clearfix" id="tabBar">
     4                 <li class="current" tips="请输入产品名称">商品</li>
     5                 <li class="tab-line"><span>|</span></li>
     6                 <li tips="请输入店铺名称">店铺</li>
     7             </ul>
     8             <div class="tab-box clearfix" id="tabBox">
     9                 <form onsubmit="" action="" method="get" name="searchForm" id="searchForm" class="clearfix">
    10                     <input class="text" id="keyword"  name="keyword" lang="zh-CN" type="text" value="请输入产品名称">
    11                     <input class="button" value="搜索" onfocus="this.blur()" type="submit">
    12                 </form>
    13             </div>
    14         </div>
    15         <div class="keyword">
    16             <a href="#"><span>男装</span></a>
    17             <a href="#"> 朵牧女鞋</a> 
    18             <a href="#">圣高男鞋</a>
    19             <a href="#"><span>女装</span></a> 
    20             <a href="#">防晒霜</a> 
    21             <a href="#">脱毛膏</a>
    22         </div>
    23     </div>
    .search{ position: absolute; top:14px; left: 34%; 477px; _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{ 38px; text-align: center; color: #444; float: left; cursor: pointer;}
    .tab-bar li.tab-line{  2px; color: #c9c9c9; margin:0 2px;}
    .tab-box{ border:2px solid #1d7ad9;}
    .text{ color: #a9a9a9; 376px; height: 31px; border:none; text-indent: 10px; float:left; outline: none; border:0;}
    .button{  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>
  • 相关阅读:
    ios常用方法
    XMPP
    ios ebooks
    uinavigationcontroller swipe back
    navigationController and ToolBar
    EMC VNX5200/5400存储 新增LUN与Hosts映射操作
    H3C交换机telnet服务认证模式配置
    配置H3C交换机ftp服务
    克隆CentOS 6.9 配置静态IP,重启网络服务时报错"eth0 does not seem to be present"
    BFS解决八数码问题和狼人过河问题
  • 原文地址:https://www.cnblogs.com/chibingning/p/3980239.html
Copyright © 2011-2022 走看看