gpt4 book ai didi

链接不工作的 HTML/CSS 轨道动画

转载 作者:行者123 更新时间:2023-11-28 03:03:39 24 4
gpt4 key购买 nike

我已经检查了我的代码一千次,但我仍然无法弄清楚如何允许单击动画对象(例如指向另一个页面的链接)。动画完美运行,但当我尝试单击链接时,它们无法正常运行。我知道页面上对象的放置存在问题,但我也不知道如何为它们制作动画,所以链接跟随动画。有没有办法只使用 HTML 和 CSS 来做到这一点?如果我必须使用其他语言,首选 Java 或 Perl。

感谢您的帮助!

这是我的相关 html 和 css:(没有包含太多样式,只是基础)

.orbit-container {
position: absolute;
top: 50%;
left: 50%;

width: 550px;
height: 550px;
margin-top: -275px;
margin-left: -275px;

border-width: 2px;
border-style: dotted;
border-color: white;
border-radius: 50%;

-webkit-animation: orbit 20s linear infinite;
-moz-animation: orbit 20s linear infinite;
-ms-animation: orbit 20s linear infinite;
-o-animation: orbit 20s linear infinite;
animation: orbit 20s linear infinite;

}
.orbit-text-container {
position: absolute;
top: 50%;
left: 50%;

width: 550px;
height: 550px;
margin-top: -275px;
margin-left: -275px;

-webkit-animation: orbit 20s linear infinite;
-moz-animation: orbit 20s linear infinite;
-ms-animation: orbit 20s linear infinite;
-o-animation: orbit 20s linear infinite;
animation: orbit 20s linear infinite;
}
@-webkit-keyframes orbit {
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}

@keyframes orbit {
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-webkit-keyframes orbit-text {
100% {
-webkit-transform: rotate(-360deg);
-moz-transform: rotate(-360deg);
-ms-transform: rotate(-360deg);
-o-transform: rotate(-360deg);
transform: rotate(-360deg);
}
}

@keyframes orbit-text {
100% {
-webkit-transform: rotate(-360deg);
-moz-transform: rotate(-360deg);
-ms-transform: rotate(-360deg);
-o-transform: rotate(-360deg);
transform: rotate(-360deg);
}
}
.orbit-text {
-webkit-animation: orbit-text 20s linear infinite;
-moz-animation: orbit-text 20s linear infinite;
-ms-animation: orbit-text 20s linear infinite;
-o-animation: orbit-text 20s linear infinite;
animation: orbit-text 20s linear infinite;
}
.circle-large-center {
top: 50%;
left: 50%;
margin-top: -190px;
margin-left: -190px;
}
.circle-small-top {
position: relative;
top: 0;
left: 50%;
margin-left: -60px;
margin-top: -60px;
}
.circle-text-top {
top: 0;
left: 0;
margin-top: -245px;
}
.circle-small-bottom {
position: relative;
top: 90%;
left: 50%;
margin-left: -60px;
margin-top: -60px;
}
.circle-text-bottom {
top: 0;
left: 0;
margin-top: 490px;
}
.circle-small-left {
position: relative;
top: 31%;
left: 100%;
margin-left: -60px;
margin-top: -60px;
}
.circle-text-left {
top: 0;
left: 20%;
margin-top: -330px;
margin-left: 330px;
}
.circle-small-right {
position: relative;
top: 20%;
left: 0;
margin-left: -60px;
margin-top: -60px;
}
.circle-text-right {
top: 0;
left: 0;
margin-left: -550px;
margin-top: -60px;
}
.circle-text-center {
top: 0;
left: 0;
width: 20%;
margin-left: 130px;
margin-top: 230px;
}
.circle-button-large {
position: absolute;
box-shadow: 2px 4px 0 2px rgba(0,0,0,0.1);
background-color: #F5FAFA;
border-radius: 50%;
height: 380px;
width: 380px;
opacity: 0.9;
}
.back-image {
background-color: #3383B8;
color: #F5FAFA;
background-repeat: no-repeat;
background-position: center;
}
.text-medium-large {
font-size: 30px;
}
.text-center {
position: relative;
text-align: center;
padding: 10px;
top: 40%;
}
<head>
<link href='https://fonts.googleapis.com/css?family=Exo:200' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
</head>
<div class="container-fluid back-image screen">
<div class="circle-button-large circle-large-center"></div>
<div class="orbit-text-container">
<div class="text-center text-medium-large circle-text-top orbit-text"><a href="text1.html">Text1</a></div>
<div class="text-center text-medium-large circle-text-bottom orbit-text"><a href="text2.html">Text2</a></div>
<div class="text-center text-medium-large circle-text-left orbit-text"><a href="text3.html">Text3</a></div>
<div class="text-center text-medium-large circle-text-right orbit-text"><a href="text4.html">Text4</a></div>
</div>
</div>

编辑:(2015 年 11 月 5 日):

这是我的 JSFiddle: https://jsfiddle.net/hkht1txy/

最佳答案

您可以使用 animation-play-state 属性在鼠标悬停时暂停动画。

.orbit-text-container:hover, .orbit-text-container:hover .orbit-text {
-webkit-animation-play-state: paused;
-moz-animation-play-state: paused;
-o-animation-play-state: paused;
animation-play-state: paused;
}

FIDDLE

.orbit-container {
position: absolute;
top: 50%;
left: 50%;
width: 550px;
height: 550px;
margin-top: -275px;
margin-left: -275px;
border-width: 2px;
border-style: dotted;
border-color: white;
border-radius: 50%;
-webkit-animation: orbit 20s linear infinite;
-moz-animation: orbit 20s linear infinite;
-ms-animation: orbit 20s linear infinite;
-o-animation: orbit 20s linear infinite;
animation: orbit 20s linear infinite;
}
.orbit-text-container:hover,
.orbit-text-container:hover .orbit-text {
-webkit-animation-play-state: paused;
-moz-animation-play-state: paused;
-o-animation-play-state: paused;
animation-play-state: paused;
}
.orbit-text-container {
position: absolute;
top: 50%;
left: 50%;
width: 550px;
height: 550px;
margin-top: -275px;
margin-left: -275px;
-webkit-animation: orbit 20s linear infinite;
-moz-animation: orbit 20s linear infinite;
-ms-animation: orbit 20s linear infinite;
-o-animation: orbit 20s linear infinite;
animation: orbit 20s linear infinite;
}
@-webkit-keyframes orbit {
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes orbit {
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-webkit-keyframes orbit-text {
100% {
-webkit-transform: rotate(-360deg);
-moz-transform: rotate(-360deg);
-ms-transform: rotate(-360deg);
-o-transform: rotate(-360deg);
transform: rotate(-360deg);
}
}
@keyframes orbit-text {
100% {
-webkit-transform: rotate(-360deg);
-moz-transform: rotate(-360deg);
-ms-transform: rotate(-360deg);
-o-transform: rotate(-360deg);
transform: rotate(-360deg);
}
}
.orbit-text {
-webkit-animation: orbit-text 20s linear infinite;
-moz-animation: orbit-text 20s linear infinite;
-ms-animation: orbit-text 20s linear infinite;
-o-animation: orbit-text 20s linear infinite;
animation: orbit-text 20s linear infinite;
}
.circle-large-center {
top: 50%;
left: 50%;
margin-top: -190px;
margin-left: -190px;
}
.circle-small-top {
position: relative;
top: 0;
left: 50%;
margin-left: -60px;
margin-top: -60px;
}
.circle-text-top {
top: 0;
left: 0;
margin-top: -245px;
}
.circle-small-bottom {
position: relative;
top: 90%;
left: 50%;
margin-left: -60px;
margin-top: -60px;
}
.circle-text-bottom {
top: 0;
left: 0;
margin-top: 490px;
}
.circle-small-left {
position: relative;
top: 31%;
left: 100%;
margin-left: -60px;
margin-top: -60px;
}
.circle-text-left {
top: 0;
left: 20%;
margin-top: -330px;
margin-left: 330px;
}
.circle-small-right {
position: relative;
top: 20%;
left: 0;
margin-left: -60px;
margin-top: -60px;
}
.circle-text-right {
top: 0;
left: 0;
margin-left: -550px;
margin-top: -60px;
}
.circle-text-center {
top: 0;
left: 0;
width: 20%;
margin-left: 130px;
margin-top: 230px;
}
.circle-button-large {
position: absolute;
box-shadow: 2px 4px 0 2px rgba(0, 0, 0, 0.1);
background-color: #F5FAFA;
border-radius: 50%;
height: 380px;
width: 380px;
opacity: 0.9;
}
.back-image {
background-color: #3383B8;
color: #F5FAFA;
background-repeat: no-repeat;
background-position: center;
}
.text-medium-large {
font-size: 30px;
}
.text-center {
position: relative;
text-align: center;
padding: 10px;
top: 40%;
}
<div class="container-fluid back-image screen">
<div class="circle-button-large circle-large-center"></div>
<div class="orbit-text-container">
<div class="text-center text-medium-large circle-text-top orbit-text"><a href="text1.html">Text1</a>
</div>
<div class="text-center text-medium-large circle-text-bottom orbit-text"><a href="text2.html">Text2</a>
</div>
<div class="text-center text-medium-large circle-text-left orbit-text"><a href="text3.html">Text3</a>
</div>
<div class="text-center text-medium-large circle-text-right orbit-text"><a href="text4.html">Text4</a>
</div>
</div>
</div>

关于链接不工作的 HTML/CSS 轨道动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33556580/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com