利用HTML5 CSS3实现气泡式图标菜单特效



20 76 26



特效描述:利用HTML5 CSS3实现 气泡式图标 菜单特效,利用HTML5 CSS3实现气泡式图标菜单特效

代码结构

1. HTML代码

<nav>
	<ul>
		<li>
			<a href="#phone" data-item="0">
				<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64" enable-background="new 0 0 64 64">
					<path fill="none" stroke="#fff" stroke-width="6" stroke-miterlimit="10" d="M46.671,57.375c0,2.003-1.643,3.625-3.667,3.625
						H20.997c-2.026,0-3.668-1.622-3.668-3.625V6.625C17.329,4.624,18.971,3,20.997,3h22.007c2.024,0,3.667,1.624,3.667,3.625V57.375z">
					<line fill="none" stroke="#fff" stroke-width="6" stroke-miterlimit="10" x1="20" y1="47" x2="44" y2="47">
					<line fill="none" stroke="#fff" stroke-width="6" stroke-miterlimit="10" x1="20" y1="12" x2="44" y2="12">
					<circle fill="#fff" cx="32" cy="54" r="3">
				</svg>
				<span>Phone</span>
			</a>
		</li>
		<li>
			<a href="#music" data-item="1">
				<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64" enable-background="new 0 0 64 64">
					<polyline fill="none" stroke="#fff" stroke-width="6" stroke-miterlimit="10" points="20,56.698 20,14.813 57,3.995 57,45.881 
					">
					<path fill="#fff" d="M13.5,48.612c5.247,0,9.5,3.443,9.5,7.698c0,4.252-4.253,7.697-9.5,7.697c-5.245,0-9.5-3.445-9.5-7.697
					C4,52.056,8.255,48.612,13.5,48.612z">
					<path fill="#fff" d="M50.503,38.621c5.245,0,9.497,3.445,9.497,7.698c0,4.252-4.252,7.697-9.497,7.697c-5.251,0-9.503-3.445-9.503-7.697
					C41,42.066,45.252,38.621,50.503,38.621z">
					<line fill="none" stroke="#fff" stroke-width="6" stroke-miterlimit="10" x1="20" y1="27.163" x2="57.016" y2="16.362">
				</svg>
				<span>Music</span>
			</a>
		</li>
		<li>
			<a href="#map" data-item="2">
				<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64" enable-background="new 0 0 64 64">
					<path fill="#fff" d="M32.001,0C20.346,0,10.898,9.448,10.898,21.103C10.898,32.688,31.986,64,31.986,64
					s21.086-31.312,21.086-42.897h0.029C53.102,9.448,43.653,0,32.001,0z M31.986,27.637c-4.016,0-7.271-3.255-7.271-7.27
					s3.255-7.27,7.271-7.27s7.269,3.255,7.269,7.27S36.002,27.637,31.986,27.637z">
				</svg>
				<span>Map</span>
			</a>
		</li>
		<li>
			<a href="#wifi" data-item="3">
				<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64" enable-background="new 0 0 64 64">
					<path fill="#fff" d="M32.008,49.836c1.928,0,3.496,1.559,3.496,3.499c0,1.939-1.567,3.499-3.496,3.499
						c-1.935,0-3.502-1.56-3.502-3.499C28.506,51.395,30.074,49.836,32.008,49.836z">
					<path fill="none" stroke="#fff" stroke-width="6" stroke-miterlimit="10" d="M22.082,44.234L22.082,44.234
						c5.486-5.79,14.376-5.79,19.857,0l0,0">
					<path fill="none" stroke="#fff" stroke-width="6" stroke-miterlimit="10" d="M52.061,33.604
						c-11.055-11.605-28.993-11.619-40.064-0.031c-0.01,0.011-0.021,0.021-0.031,0.031l0,0">
					<path fill="none" stroke="#fff" stroke-width="6" stroke-miterlimit="10" d="M61.819,23.229C45.383,5.831,18.713,5.81,2.25,23.18
						c-0.014,0.017-0.03,0.032-0.046,0.049l0,0">
				</svg>
				<span>Wi-Fi</span>
			</a>
		</li>
		<li>
			<a href="#settings" data-item="4">
				<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64" enable-background="new 0 0 64 64">
					<path fill="#fff" d="M61.89,24.271l-6.927-0.707c-0.476-1.31-1.06-2.577-1.751-3.788c-0.701-1.205-1.496-2.349-2.389-3.418
					l2.858-6.352c0.466-1.086,0.049-2.351-0.973-2.948l-9.34-5.451c-1.036-0.6-2.36-0.319-3.065,0.648L36.164,7.9
					c-2.757-0.477-5.573-0.477-8.327,0l-4.068-5.644c-0.705-0.967-2.028-1.248-3.065-0.648L11.318,7.03
					c-1.021,0.596-1.439,1.86-0.973,2.948l2.845,6.335c-1.787,2.147-3.192,4.584-4.157,7.206l-6.925,0.707
					C0.912,24.348,0.002,25.354,0,26.556v10.844c-0.021,1.22,0.895,2.251,2.107,2.374l6.925,0.708c0.96,2.621,2.366,5.061,4.157,7.204
					l-2.845,6.337c-0.467,1.089-0.049,2.35,0.973,2.947l9.386,5.423c1.037,0.6,2.36,0.319,3.065-0.647l4.082-5.646
					c2.754,0.478,5.571,0.478,8.328,0l4.062,5.632c0.71,0.967,2.029,1.247,3.065,0.647l9.387-5.422c1.022-0.598,1.439-1.861,0.974-2.948
					l-2.844-6.337c1.79-2.146,3.194-4.583,4.154-7.207l6.926-0.705c1.186-0.13,2.087-1.123,2.097-2.314V26.599
					C63.995,25.397,63.084,24.392,61.89,24.271z M32.229,45.654c-7.374,0-13.351-5.979-13.351-13.352
					c0-7.374,5.977-13.351,13.351-13.351c7.37,0,13.352,5.977,13.352,13.351C45.58,39.675,39.599,45.654,32.229,45.654z">
				</svg>
				<span>Settings</span>
			</a>
		</li>
	</ul>
</nav>
<script>
document.addEventListener("DOMContentLoaded", function(){
	let rise = function(trigEl) {
			trigEl.blur();
			let ul = document.querySelector("ul");
			ul.classList.add("rise");
			trigEl.classList.add("pop");
			setTimeout(function(){
				trigEl.focus();
				ul.classList.remove("rise");
				trigEl.classList.remove("pop");
			}, 1000);
		};
	this.querySelectorAll("li a").forEach(function(el){
		let rt = document.querySelector(":root"),
			di = +el.getAttribute("data-item");
		el.addEventListener("blur",function(){
			//var getRt = +window.getComputedStyle(el).getPropertyValue('--rotateTimes');
			//console.log(getRt);
			//this.classList.add("current");
		});
		el.addEventListener("focus",function(){
			rt.style.setProperty("--rotateTimes",di);
			//this.classList.remove("current");
		});
		el.addEventListener("dblclick",function(){
			rise(this);
		});
		el.addEventListener("keyup",function(e){
			if (e.keyCode === 13) {
				rise(this);
			}
		});
	});
});
</script>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 滚动导航菜单 滚动菜单 滚动导航 滑动导航菜单 滑动导航 滑动菜单 浮动菜单 浮动导航 导航切换 菜单切换 右键菜单 收缩菜单 收缩导航 h5动画导航 h5动画菜单 html5动画导航 html5动画菜单 flash导航菜单 flash导航条 flash导航 flash菜单 flash下拉菜单 flash下拉导航菜单 旋转翻转 旋转 翻转 导航菜单 导航条 菜单栏 导航栏 分类导航 响应式导航条 响应式导航 旋转木马 图片旋转木马 文字旋转木马 旋转木马插件 图标导航 图标菜单

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到