Get translate3d values of a div?

前端 未结 6 728
难免孤独
难免孤独 2020-11-30 12:30

Say a div has this applied to it:

-webkit-transform: translate3d(0px, -200px, 0px)

How could I retrieve those values with jQuery?

6条回答
  •  借酒劲吻你
    2020-11-30 13:23

    EDIT: This is wrong, ignore this.

    I think if you do something like...

    var styles = $('.myclass').css('-webkit-transform');
    

    You would probably get the translate3d(0px, -200px, 0px) back.

    Maybe you could then parse that string? seems like a bit of a hack though.

提交回复
热议问题