如何为两个层进行CSS悬停过渡。我写了整个页面,以便您可以(复制/粘贴)从您的计算机桌面上进行尝试。我有什么作品,但是可以在没有JavaScript和纯CSS的jQuery的情况下完成?我尝试了CSS指针事件,并能够转换顶层(#circleOuter)或底层(#circleInner),但不能同时转换两层。为此,#circleOuter:hover必须触发#circleInner。任何帮助表示赞赏。CSS底层和顶层的悬停触发器
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
$(document).ready(function(){
$("#circleOuter").hover(function(){
$("#circleInner").css("transform","rotate(180deg)");
$("#circleOuter").css("transform","rotate(-180deg)");
}, function(){
$("#circleInner").css("transform","rotate(0deg)");
$("#circleOuter").css("transform","rotate(0deg)");
});
});
</script>
<style>
#circleWrap
{
background:#ff0;
width:200px;
height:200px;
position:relative;
}
#circleInner
{
background:url(http://socalsky.com/_/images/mis/circle_inner.png) center center/ 188px 188px no-repeat;
width:200px;
height:200px;
position:absolute;
transform: rotate(0deg);
transition: 500ms ease all;
}
#circleOuter
{
background:url(http://socalsky.com/_/images/mis/circle_outer.png) center center/ 200px 200px no-repeat;
width:200px;
height:200px;
position:absolute;
transform: rotate(0deg);
transition: 500ms ease all;
}
</style>
</head>
<body>
<div id="circleWrap">
<div id="circleInner">
</div>
<div id="circleOuter">
</div>
</div>
</body>
</html>
听起来真的很好DaniP,会试试这个aswel,给我几个尝试所有这一切。谢谢一堆! – Kobbe
这可能是一个问了一个问题。我如何将答案标记为正确答案? – Kobbe
@Kobbe您可以在答案左侧的投票中看到灰色的复选标记 – DaniP