gpt4 book ai didi

javascript - 缩放div跳转旁边的div

转载 作者:太空宇宙 更新时间:2023-11-04 02:46:28 24 4
gpt4 key购买 nike

当我将鼠标悬停在一个圆圈上时,其余的人只会在圆圈动画时跳跃。我该如何解决?

$(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>

最佳答案

vertical-align:top; 添加到您的 .circle CSS 规则以停止跳跃:

$(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;
vertical-align:top;
}
<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>

关于javascript - 缩放div跳转旁边的div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33785284/

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