我是一個新手j查詢和我有這個網站,我與前一段時間建立了閃存。現在我想用j Query來做出同樣的效果。請在下面的URL中查看效果。Jquery on Hover Bounc and Ease
我嘗試過的一些事情看下面的代碼,但東西是不正確的,不光滑,每一次我懸停在任何圓的時候,我得到螢火蟲的控制檯上的錯誤。請指點隊友,感謝
<div class="circle floatleft" id="circle1"><p>Circle One</p></div>
<div class="circle floatleft" id="circle2"><p>Circle two</p></div>
<div class="circle floatleft" id="circle3"><p>Circle three</p></div>
<div class="circle floatleft" id="circle4"><p>Circle four</p></div>
我對演示目的
.circle{border-radius: 50%;border: 5px solid #FFBD00;background:#4679BD;color:#fff;text-align:center;margin:auto;vertical-align:middle;padding:20px;min-width:100px;min-height:100px;}
.floatleft一些簡單的CSS {浮動:左;} .circle> p {垂直對齊:中間;保證金:汽車;文本對齊:中心;}
的,我是用
$(".circle").hover(function() {
//resize other circles
var circleHeight = $(".circle").height();
var circleWidth = $(".circle").width();
$(".circle").animate({'opacity' : '0.5', 'height' : circleHeight/4, 'width' : circleWidth/4});
var $this = $(this);
$this.animate({
'height': $this.height() * 1.2,
'width' : $this.width() * 1.2,
'opacity' : '1'
});
},function() {
$(".circle").animate({'opacity' : '1', 'height' : circleHeight * 4, 'width' : circleWidth * 4});
var $this = $(this);
$this.animate({
'height': $this.height()/1.2,
'width' : $this.width()/1.2
});
});