Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8423365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:42:17+00:00 2026-06-10T03:42:17+00:00

In this example; i am trying to create a jQuery animation with css3 rotate

  • 0

In this example; i am trying to create a jQuery animation with css3 rotate property. I can manage this animation with css3 transition and jQuery css() but i want to do this with jQuery animate() for rotating deg value according to my jQuery variatons.

Is it possible use animate with css3 property value with jQuery 1.8.0?

Here is jsFiddle to inspect.

jQuery:

var rotateVal = 90;

//this method isn't working
$('.red').animate({
    'transform':'rotate('+rotateVal+'deg)'
},500);


//this way works but i don't want to do this with transitions
$('.black').css({
    'transform':'rotate('+rotateVal+'deg)',
    'transition':'1s'
});​

html:

<span class="black"></span>
<span class="red"></span>

Edit: Vendor prefixes removed, like -webkit-. Thanks to Kevin B.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:42:19+00:00Added an answer on June 10, 2026 at 3:42 am

    It is possible, but it isn’t easy.

    var red = $(".red"),
        rotateVal = 90;
    $("<div />").animate({
        height: rotateVal
    },{
        duration: 500,
        step: function(now){
            red.css('transform','rotate('+now+'deg)');
        }
    });
    

    This basically creates a fake animation of a detached div, then on each step, updates the rotation of the target div.

    Edit: Oops! wrong argument order. Here’s a demo. http://jsfiddle.net/qZRdZ/

    note that in 1.8.0 i don’t think you need to specify all the vendor prefixes.

    Using this method, you can animate almost anything as long as you keep in mind that things like += and -= won’t work properly unless coded for.

    Update: Here’s a combination of my solution and cuzzea’s solution abstracted behind a function. http://jsfiddle.net/qZRdZ/206/

    $.fn.rotate = function(start, end, duration) {
        console.log(this);
        var _this = this;
        var fakeDiv = $("<div />");
        _this.promise().done(function(){
            _this.animate({"a":end},{duration:duration});
            fakeDiv.css("height", start).animate({
                height: end
            }, {
                duration: duration,
                step: function(now) {
                    _this.css("transform", "rotate(" + now + "deg)");
                },
                complete: function() {
                    fakeDiv.remove();
                }
            });
        });
    
        return _this;
    };
    
    var red = $('.red');
    red.click(function() {
        if ( !$(this).is(':animated') ) {
    
            red.rotate(45,135,500);
            setTimeout(function(){
                red.rotate(135,190,500);
            },750);
            setTimeout(function(){
                red.rotate(190,45,500);
            },1500);
        }
    });
    

    });

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I do inheritance with this example. I'm trying to create an object
I am trying to create a slider like this example. pls anyone help me.
I trying to create an animation with JQuery that scrolls 1 word in a
I am trying to create an animation using jquery by where the text shoots
This is my first plugin trying to create using the example provided here .
I'm trying to create a basic version of this example in CoffeeScript: http://davidsulc.com/blog/2012/04/15/a-simple-backbone-marionette-tutorial/ .
Im trying to create a game with jQuery, but none of the options after
http://jsfiddle.net/nicktheandroid/BcaW3/1/ I'm trying to create a simple canvas version of my jQuery example. When
I'm new to jQuery, and I'm trying to create the most basic example of
I'm trying to create a filter / tagging system. This answer works well but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.