AngularJS 实现图片旋转(CSS)

时间:2014-10-15 15:46:32   收藏:0   阅读:1800

图片旋转基于 CSS:transform:rotate(**deg) 实现,Angular 用于动态绑定 deg 数:

controller:(其实可以省略)

$scope.img = {src:"xxx.png", rotate=0};

HTML:

<button ng-click="img.rotate=img.rotate+90">向右转</button>
<button ng-click="img.rotate=img.rotate-90">向左转</button>

<img ng-src="img.src" style="transform:rotate({{img.rotate}}deg);">

原文:http://my.oschina.net/lionets/blog/331785

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!