简体   繁体   English

如何使用jQuery旋转图像一侧

[英]how to Rotate image one side using jquery

I am trying to rotate a image only one corner.image is like a pole .bottom side should not be changed the position only top of the image should be animate either clockwise or anti clockwise.i have tried like this.i should work in IE8 also.i made left:53px because bottom should not be change the position. 我正在尝试仅将图像旋转一个角。图像就像一根杆子。不应改变底部侧面的位置,仅图像顶部应顺时针或逆时针设置动画。我已经尝试过这样。我应该在IE8中工作Also.i取得left:53px因为不应更改底部。

<style>
    .big-pole{
      background-image: url("images/pole.png");
      width: 55px;
      height: 100px;
      position: absolute;
      top: 78px;
      left: 53px;
    }
</style>
<script>
     TweenMax.to(".big-pole",3,{
        top:'100px',
        left:'53px',
       });

</script>

You could apply CSS class to image without any need of external libraries. 您可以将CSS类应用于图像,而无需外部库。

.rotated {
  transform: rotate(90deg);
  -ms-transform: rotate(90deg); /* IE 9 */
  -moz-transform: rotate(90deg); /* Firefox */
  -webkit-transform: rotate(90deg); /* Safari and Chrome */
  -o-transform: rotate(90deg); /* Opera */
  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); /* IE 8*/
}

I'm not really sure if I understand correctly what kind of rotation you are looking for? 我不确定我是否正确理解您要寻找的旋转方式? Is it like a clock as other users pointed out? 就像其他用户指出的时钟一样吗? Anyway your TweenMax call was missing some parameters in order for the rotation to work. 无论如何,您的TweenMax调用缺少一些参数,以使旋转正常进行。

TweenMax.to($(".big-pole"), 3, {rotation:-90, transformOrigin:"top center"});

You will have test a few things and change a few value to find the correct animation, cause I might be wrong a bit, all depending on what you want to do in the end. 您将进行一些测试,并更改一些值以找到正确的动画,导致我可能做错了一点,这全都取决于您最终想要做什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM