0

Hi I'm trying to optimize animations with jquery for IOS mobile devices. There is this known issue of using the 3d-rendering engine which i want to take into account!

Now i want to do some transformations like this:

$('.class').css({"-webkit-transform:":"translate3d(200px, 200px, 0px)"});

But this doesn't work! No css is added!

3 Answers 3

1

Without knowing the rest of your code, did you apply a -webkit-transition? Otherwise the effect would happen almost immediately.

The below works fine for me (working jsfiddle -> http://jsfiddle.net/RQzn6/)

HTML

<div id="container">
    <div id="box">Hello</div>
</div>

CSS

#container {
    -webkit-transform-style: preserve-3d;
    -webkit-perspective: 100px;
}

#box {
    width: 200px;
    height: 100px;
    background-color: gray;
}

jQuery

$("#box").click(function() {
    $(this).css({'-webkit-transform':'translate3d(200px, 200px, 0px)',
                 '-webkit-transition': 'all 1s ease-out'});
    });
Sign up to request clarification or add additional context in comments.

Comments

1

I discovered Transit yesterday, you might find it easier if you don't mind adding a library.

1 Comment

For most of the stuff I think you have to use .animate.
0

Have you forgot to add

-webkit-transform-style: preserve-3d;  ??

You have to add preserve 3d also .

1 Comment

Sorry.. :( no clues.In my case i forgot that and searched half google :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.