jQuery + css 3 사 이 드 바 탐색 메뉴
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery CSS3 - </title><base target="_blank" />
<!-- -->
<style type="text/css">
* {
margin: 0;
padding: 0;
}
/*hovertreenav styles*/
.hovertreenav ul {
background: white;
border-top: 6px solid hsl(180, 40%, 60%);
width: 200px;
margin: 5em auto;
}
.hovertreenav ul li {
list-style-type: none;
/*relative positioning for list items along with overflow hidden to contain the overflowing ripple*/
position: relative;
overflow: hidden;
}
.hovertreenav ul li a {
font: normal 14px/28px Montserrat;
color: hsl(180, 40%, 40%);
display: block;
padding: 10px 15px;
text-decoration: none;
cursor: pointer; /*since the links are dummy without href values*/
/*prevent text selection*/
user-select: none;
/*static positioned elements appear behind absolutely positioned siblings(.ink in this case) hence we will make the links relatively positioned to bring them above .ink*/
position: relative;
}
/*.ink styles - the elements which will create the ripple effect. The size and position of these elements will be set by the JS code. Initially these elements will be scaled down to 0% and later animated to large fading circles on user click.*/
.hovertreenav .ink {
display: block;
position: absolute;
background: hsl(180, 40%, 80%);
border-radius: 100%;
transform: scale(0);
}
/*animation effect*/
.hovertreenav .ink.animate {
animation: ripple 0.65s linear;
}
@keyframes ripple {
/*scale the element to 250% to safely cover the entire link and fade it out*/
100% {
opacity: 0;
transform: scale(2.5);
}
}
</style>
<!--[if IE]>
<script src="http://hovertree.com/texiao/html5/4/html5shiv.min.js"></script>
<![endif]-->
</head>
<body style="background:#D1EFFE;">
<div class="hovertreenav">
<ul>
<li><a href="http://hovertree.com"> </a></li>
<li><a href="http://hovertree.com/menu/bootstrap/">Bootstrap</a></li>
<li><a href="http://hovertree.com/menu/jquery/">jQuery</a></li>
<li><a href="http://hovertree.com/menu/webfront/">web </a></li>
<li><a href="http://hovertree.com/h/bjaf/kqud99m6.htm">CSS3 </a></li>
<li><a href="http://hovertree.com/h/bjaf/mcpnogp6.htm">HTML5 </a></li>
<li><a> </a></li>
</ul>
</div>
<script type="text/javascript" src="http://hovertree.com/ziyuan/jquery/jquery-1.12.1.min.js"></script>
<script type="text/javascript">
//jQuery time
var parent, ink, d, x, y;
$(".hover"+"treenav ul li a").click(function(e){
parent = $(this).parent();
//create .ink element if it doesn't exist
if(parent.find(".ink").length == 0)
parent.prepend("<span class='ink'></span>");
ink = parent.find(".ink");
//incase of quick double clicks stop the previous animation
ink.removeClass("animate");
//set size of .ink
if(!ink.height() && !ink.width())
{
//use parent's width or height whichever is larger for the diameter to make a circle which can cover the entire element.
d = Math.max(parent.outerWidth(), parent.outerHeight());
ink.css({height: d, width: d});
}
//get click coordinates
//logic = click coordinates relative to page - parent's position relative to page - half of self height/width to make it controllable from the center;
x = e.pageX - parent.offset().left - ink.width()/2;
y = e.pageY - parent.offset().top - ink.height()/2;
//set the position and add class .animate
ink.css({top: y+'px', left: x+'px'}).addClass("animate");
})
</script>
</body>
</html>
웹 전단 집계:http://www.cnblogs.com/jihua/p/webfront.html
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.