当我将鼠标悬停在圆圈上时,其余部分只会在圆圈动画时跳跃。我该如何解决这个问题?
$(document).ready(function() {
$('#header').hide();
$('#openSidebarIcon').hide();
$('#seasonText').hide();
$('#seasonDays').hide();
$('#iconSidebar').hide();
var firstLetter = '';
$('.circle').hover(function() {
$(this).stop(true, true).animate({
width: 300
}, 200);
var id = '#' + $(this).attr('id') + 'a';
console.log(id);
var fullDisplayText = '';
switch (id) {
case '#1a':
fullDisplayText = 'REDMARKET';
firstLetter = 'R';
break;
case '#2a':
fullDisplayText = 'TINSER.NET';
firstLetter = 'T';
break;
case '#3a':
fullDisplayText = 'PHALLET';
firstLetter = 'P';
break;
case '#4a':
fullDisplayText = 'ANIMALZ';
firstLetter = 'A';
break;
case '#5a':
fullDisplayText = 'LEARNUNG';
firstLetter = 'L';
break;
case '#6a':
fullDisplayText = 'PROGRAMM';
firstLetter = 'P';
break;
case '#7a':
fullDisplayText = 'DOITURSELF';
firstLetter = 'D';
break;
case '#8a':
fullDisplayText = 'GAAMERZ';
firstLetter = 'C';
break;
}
$(id).text(fullDisplayText);
}, function() {
var id = '#' + $(this).attr('id') + 'a';
$(id).text(firstLetter);
$(this).stop(true, true).animate({
width: 60
}, 200);
});
$('#menulogo').animate({
opacity: 1
}, 1000);
setTimeout(function() {
$('#1').animate({
opacity: 1
}, 500);
setTimeout(function() {
$('#2').animate({
opacity: 1
}, 500);
}, 250);
setTimeout(function() {
$('#3').animate({
opacity: 1
}, 500);
}, 500);
setTimeout(function() {
$('#4').animate({
opacity: 1
}, 500);
}, 750);
setTimeout(function() {
$('#5').animate({
opacity: 1
}, 500);
}, 1000);
setTimeout(function() {
$('#6').animate({
opacity: 1
}, 500);
}, 1250);
setTimeout(function() {
$('#7').animate({
opacity: 1
}, 500);
}, 1500);
setTimeout(function() {
$('#8').animate({
opacity: 1
}, 500);
}, 1750);
}, 750);
});
.circle {
width: 60px;
height: 60px;
border-radius: 30px;
margin-top: 5px;
display: inline-block;
cursor: pointer;
opacity: 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<center>
<img src='lib/img/tinserlogo.png' style='margin-top: 60px; opacity: 0;' id='menulogo'>
</center>
<center>
<div id='1' class='circle' style='background-color: #FF0000;'><font id='1a' style='font-size: 48px; font-family: Futura; color: #FFFFFF;'>R</font>
</div>
<div id='2' class='circle' style='background-color: #FF9100; margin-left: 20px;'><font id='2a' style='font-size: 48px; font-family: Futura; color: #FFFFFF;'>T</font>
</div>
<div id='3' class='circle' style='background-color: #FFE600; margin-left: 20px;'><font id='3a' style='font-size: 48px; font-family: Futura; color: #FFFFFF;'>P</font>
</div>
<div id='4' class='circle' style='background-color: #37FF00; margin-left: 20px;'><font id='4a' style='font-size: 48px; font-family: Futura; color: #FFFFFF;'>A</font>
</div>
<div id='5' class='circle' style='background-color: #00FFF3; margin-left: 20px;'><font id='5a' style='font-size: 48px; font-family: Futura; color: #FFFFFF;'>L</font>
</div>
<div id='6' class='circle' style='background-color: #001AFF; margin-left: 20px;'><font id='6a' style='font-size: 48px; font-family: Futura; color: #FFFFFF;'>P</font>
</div>
<div id='7' class='circle' style='background-color: #FF00F3; margin-left: 20px;'><font id='7a' style='font-size: 48px; font-family: Futura; color: #FFFFFF;'>D</font>
</div>
<div id='8' class='circle' style='background-color: #000000; margin-left: 20px;'><font id='8a' style='font-size: 48px; font-family: Futura; color: #FFFFFF;'>C</font>
</div>
</center>
答案 0 :(得分:2)
将GPU GPU 0
添加到您的vertical-align:top;
CSS规则中以停止跳转:
.circle
&#13;
$(document).ready(function() {
$('#header').hide();
$('#openSidebarIcon').hide();
$('#seasonText').hide();
$('#seasonDays').hide();
$('#iconSidebar').hide();
var firstLetter = '';
$('.circle').hover(function() {
$(this).stop(true, true).animate({
width: 300
}, 200);
var id = '#' + $(this).attr('id') + 'a';
console.log(id);
var fullDisplayText = '';
switch (id) {
case '#1a':
fullDisplayText = 'REDMARKET';
firstLetter = 'R';
break;
case '#2a':
fullDisplayText = 'TINSER.NET';
firstLetter = 'T';
break;
case '#3a':
fullDisplayText = 'PHALLET';
firstLetter = 'P';
break;
case '#4a':
fullDisplayText = 'ANIMALZ';
firstLetter = 'A';
break;
case '#5a':
fullDisplayText = 'LEARNUNG';
firstLetter = 'L';
break;
case '#6a':
fullDisplayText = 'PROGRAMM';
firstLetter = 'P';
break;
case '#7a':
fullDisplayText = 'DOITURSELF';
firstLetter = 'D';
break;
case '#8a':
fullDisplayText = 'GAAMERZ';
firstLetter = 'C';
break;
}
$(id).text(fullDisplayText);
}, function() {
var id = '#' + $(this).attr('id') + 'a';
$(id).text(firstLetter);
$(this).stop(true, true).animate({
width: 60
}, 200);
});
$('#menulogo').animate({
opacity: 1
}, 1000);
setTimeout(function() {
$('#1').animate({
opacity: 1
}, 500);
setTimeout(function() {
$('#2').animate({
opacity: 1
}, 500);
}, 250);
setTimeout(function() {
$('#3').animate({
opacity: 1
}, 500);
}, 500);
setTimeout(function() {
$('#4').animate({
opacity: 1
}, 500);
}, 750);
setTimeout(function() {
$('#5').animate({
opacity: 1
}, 500);
}, 1000);
setTimeout(function() {
$('#6').animate({
opacity: 1
}, 500);
}, 1250);
setTimeout(function() {
$('#7').animate({
opacity: 1
}, 500);
}, 1500);
setTimeout(function() {
$('#8').animate({
opacity: 1
}, 500);
}, 1750);
}, 750);
});
&#13;
.circle {
width: 60px;
height: 60px;
border-radius: 30px;
margin-top: 5px;
display: inline-block;
cursor: pointer;
opacity: 0;
vertical-align:top;
}
&#13;