El *_*ude 6 javascript ionic-framework ionicons
我想用箭头显示方向,并且正在考虑使用标准离子箭头作为方向.我能以某种方式将向上箭头旋转到任何方向吗?
ion-arrow-up-a
Run Code Online (Sandbox Code Playgroud)
以下是对以下评论的尝试
<i class="icon ion-arrow-up-a" rotate degrees="90"></i>
angular.module('app.customDirectives', []).directive('rotate', function() {
return {
link: function(scope, element, attrs) {
// watch the degrees attribute, and update the UI when it changes
scope.$watch(attrs.degrees, function(rotateDegrees) {
// console.log(rotateDegrees);
//transform the css to rotate based on the new rotateDegrees
element.css({
'-moz-transform': 'rotate(' + rotateDegrees + 'deg)',
'-webkit-transform': 'rotate(' + rotateDegrees + 'deg)',
'-o-transform': 'rotate(' + rotateDegrees + 'deg)',
'-ms-transform': 'rotate(' + rotateDegrees + 'deg)'
});
});
}
}
});
Run Code Online (Sandbox Code Playgroud)
小智 8
与上面类似,这就是我做的...
HTML:
<i class="ion-arrow-up-c rotate-90">
Run Code Online (Sandbox Code Playgroud)
CSS:
.rotate-90 {
display: inline-block;
transform: rotate(90deg);
}
Run Code Online (Sandbox Code Playgroud)
还有其他箭头变体:
ion-arrow-up-a
ion-arrow-right-a
ion-arrow-down-a
ion-arrow-left-a
Run Code Online (Sandbox Code Playgroud)
或者......据我所知,离子框架是基于HTML5的,因此您可以使用CSS样式.
.style {
-moz-transform: rotate(15deg);
-webkit-transform: rotate(15deg);
-o-transform: rotate(15deg);
-ms-transform: rotate(15deg);
transform: rotate(15deg);
}
Run Code Online (Sandbox Code Playgroud)
如果您想要动态旋转,则必须检查此网址.
特别是对于IonicIcons,rotate属性仅适用于设置为"inline"或"inline-block"的display属性,它也可以与inline的其他变体一起使用.
然后你可以使用CSS正常旋转它们
transform: rotate(90deg);
Run Code Online (Sandbox Code Playgroud)