문제

I made this script but now I want it as one javascript: http://jsfiddle.net/SamuraiFox/p9sDB/

Or at least "translate" this part into javascript:

-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
도움이 되었습니까?

해결책

You could use jQuery's animate

$("#circle").animate({
    width: 0,
    height: 0,
  }, 1000);

You could also add an 'easing' attribute if you need to play with it. You'd have to install a jQuery easing plugin though, like this one : http://gsgd.co.uk/sandbox/jquery/easing/

By default, jQuery's easing method is swing. linear is also implemented in jQuery.

JSFiddle : http://jsfiddle.net/p9sDB/4/

다른 팁

you can just add the css per javascript

http://jsfiddle.net/pixelass/p9sDB/5/

function resize() {
    $("#circle").css({
        "transition": "all 1s ease",
        "width": "0px",
        "height": "0px"
    });
}

it is recommended to use css-animations instead of jQuery animate

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top