5

嗨,有没有人可以告诉我如何使用 jquery 使用一些延迟/动画速度来重现这个 css3 效果?

.element:hover{
-moz-transform: scale(1.3) rotate(0deg) translate(0px, 0px) skew(0deg, 0deg);
-webkit-transform: scale(1.3) rotate(0deg) translate(0px, 0px) skew(0deg, 0deg);
-o-transform: scale(1.3) rotate(0deg) translate(0px, 0px) skew(0deg, 0deg);
-ms-transform: scale(1.3) rotate(0deg) translate(0px, 0px) skew(0deg, 0deg);
transform: scale(1.3) rotate(0deg) translate(0px, 0px) skew(0deg, 0deg);
z-index:9999;

}

JSFIDDLE

4

2 回答 2

2

以下是我可能会如何实现简单旋转(不考虑帧速率):

$(function(){
    (function(n){
        this.interval = n;
        this.transform = {
            'rotation': 0
        };

        this.start = function(){
            setInterval(this.update, this.interval);
        };

        this.update = function(){
            this.transform['rotation'] = (this.transform.rotation + 10) % 360;
            $('div').css('transform', 'rotate(' + this.transform.rotation + 'deg)');
        };
        return this;
    })(30).start();
});

http://jsfiddle.net/dbrecht/82aUL/1/

这演示了一个简单的动画。您应该能够弄清楚如何将其余部分放在一起。

于 2011-09-08T01:35:27.310 回答
1

这是非常接近您所要求的内容。我相信你可以根据自己的喜好调整它

$('.element').hover(function(){

    $(this).css('position','relative').animate({
        height: $(this).height()*1.3,
        width: $(this).width()*1.3,
        left: '-=' + $(this).width() /4,
        top: '-=' + $(this).height() /4,
        'fontSize': $('.element').css('fontSize').substring(0,$('.element').css('fontSize').length -2) * 1.3 + 'px'
    },'fast');
},
 function() {                 
       $(this).css('position','relative').animate({
        height: $(this).height()/1.3,
        width: $(this).width()/1.3,
        left: 0,
        top: 0,
        'fontSize': $('.element').css('fontSize').substring(0,$('.element').css('fontSize').length -2) / 1.3 + 'px'
    },'fast');
}            

);

http://jsfiddle.net/dTkhM/2/

于 2011-09-08T14:13:35.193 回答