html5酷炫的ui搜索框动画

来源:https://www.sucaihuo.com/js/2958.html 2017-09-09 20:40浏览(1177) 收藏

一款html5酷炫的ui搜索框动画,一共有11种效果,基本都时通过点击搜索图标按钮,然后出现不同到搜索框动画效果,可通过点击叉号来关闭当前搜索框。
html5酷炫的ui搜索框动画
分类:表单代码 > 搜索框 难易:初级
查看演示 下载资源 下载积分: 20 积分

页面的head部分,需对接谷歌的字体库并引入页面元素的样式,代码如下:

<link href="https://fonts.googleapis.com/css?family=Inconsolata:400,700" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="css/demo.css" />
<link type="text/css" rel="stylesheet" href="css/style1.css" />

页面的head部分,需设置好动画容器和显示内容,代码如下:

<svg class="hidden">
	<defs>
		<symbol id="icon-arrow" viewBox="0 0 24 24">
			<title>arrow</title>
			<polygon points="6.3,12.8 20.9,12.8 20.9,11.2 6.3,11.2 10.2,7.2 9,6 3.1,12 9,18 10.2,16.8 "/>
		</symbol>
		<symbol id="icon-drop" viewBox="0 0 24 24">
			<title>drop</title>
			<path d="M12,21c-3.6,0-6.6-3-6.6-6.6C5.4,11,10.8,4,11.4,3.2C11.6,3.1,11.8,3,12,3s0.4,0.1,0.6,0.3c0.6,0.8,6.1,7.8,6.1,11.2C18.6,18.1,15.6,21,12,21zM12,4.8c-1.8,2.4-5.2,7.4-5.2,9.6c0,2.9,2.3,5.2,5.2,5.2s5.2-2.3,5.2-5.2C17.2,12.2,13.8,7.3,12,4.8z"/><path d="M12,18.2c-0.4,0-0.7-0.3-0.7-0.7s0.3-0.7,0.7-0.7c1.3,0,2.4-1.1,2.4-2.4c0-0.4,0.3-0.7,0.7-0.7c0.4,0,0.7,0.3,0.7,0.7C15.8,16.5,14.1,18.2,12,18.2z"/>
		</symbol>
		<symbol id="icon-search" viewBox="0 0 24 24">
			<title>search</title>
			<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
		</symbol>
		<symbol id="icon-cross" viewBox="0 0 24 24">
			<title>cross</title>
			<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
		</symbol>
	</defs>
</svg>

<main class="main-wrap">
	<header class="jq22-header">
		<div class="search-wrap">
			<button id="btn-search" class="btn btn--search"><svg class="icon icon--search"><use xlink:href="#icon-search"></use></svg></button>
		</div>
	</header>
	<div class="bottom-nav">
		<nav class="jq22-demos">
			<span>More demos: </span>
			<a class="current-demo" href="index.html">1</a>
			<a href="index2.html">2</a>
			<a href="index3.html">3</a>
			<a href="index4.html">4</a>
			<a href="index5.html">5</a>
			<a href="index6.html">6</a>
			<a href="index7.html">7</a>
			<a href="index8.html">8</a>
			<a href="index9.html">9</a>
			<a href="index10.html">10</a>
			<a href="index11.html">11</a>
		</nav>
	</div>
	<div class="search">
		<button id="btn-search-close" class="btn btn--search-close" aria-label="Close search form"><svg class="icon icon--cross"><use xlink:href="#icon-cross"></use></svg></button>
		<form class="search__form" action="">
			<input class="search__input" name="search" type="search" placeholder="drones" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
			<span class="search__info">Hit enter to search or ESC to close</span>
		</form>
		<div class="search__related">
			<div class="search__suggestion">
				<h3>May We Suggest?</h3>
				<p>#drone #funny #catgif #broken #lost #hilarious #good #red #blue #nono #why #yes #yesyes #aliens #green</p>
			</div>
			<div class="search__suggestion">
				<h3>Is It This?</h3>
				<p>#good #red #hilarious #blue #nono #why #yes #yesyes #aliens #green #drone #funny #catgif #broken #lost</p>
			</div>
			<div class="search__suggestion">
				<h3>Needle, Where Art Thou?</h3>
				<p>#broken #lost #good #red #funny #hilarious #catgif #blue #nono #why #yes #yesyes #aliens #green #drone</p>
			</div>
		</div>
	</div><!-- /search -->
</main>

页面的底部,引入不同页面的JS文件,代码如下:

<script type="text/javascript" src="js/demo1.js"></script>
标签: 搜索框svg
评论0
头像

系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791

1 2