HTML5+jquery實現的搜索匹配效果,或者說是搜索過濾,當你在文本框輸入一個字符時,如果下邊的列表中有以此為開頭的內容時,將自動為你顯示相關內容,示例中僅列出了一些,用時候你可以自己再完善下,代碼僅為您提供一種思路,我想對你是有幫助的
效果圖:
代碼如下:
!DOCTYPE html html head lang= en meta charset= UTF-8 meta name= author content= dony meta http-equiv= cache-control content= no-cache meta http-equiv= pragma content= no-cache meta name= renderer content= webkit meta http-equiv= Content-Type content= text/html; charset=utf-8 meta http-equiv= X-UA-Compatible content= IE=edge,chrome=1 meta name= viewport content= width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no,minimal-ui title dony /title link rel= stylesheet href= http://api.snaillove.com/cloudmusic/static/css/bootstrap.min.css rel= external nofollow style type= text/css p,li,ul{margin: 0;padding: 0;} ul li{list-style: none;} .basic-grey{width: 600px;margin: 5% 10%;} .basic-grey .Companies{position:relative;} .basic-grey .Companies ul{position: relative; height: 210px; width: 100%;overflow-y: auto;border: 1px solid #DDD; display: none;} .basic-grey .Companies ul li{ padding:3px 12px;} .basic-grey .Companies ul li:hover{background-color:#bebebe; cursor: pointer;} .basic-grey .Companies ul li.top{position: absolute;top: 0;} /style /head body p >以上就是本文的全部內容,希望對大家的學習有所幫助,更多相關內容請關注PHP !
相關推薦:
Html和css實現純文字和帶圖標的按鈕的代碼
如何在html中顯示JSON數據
以上就是HTML5和jQuery實現搜索智能匹配的功能的詳細內容,html教程
鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。
新聞熱點
疑難解答