javascript - 旋转页面上的 ionic 图标

标签 javascript ionic-framework ionicons

我想用箭头显示方向,并考虑使用标准 ionic 箭头作为方向。 我能以某种方式将向上箭头旋转到任何方向吗?

ion-arrow-up-a

下面是评论的尝试

<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)'
                    });
                });
            }
    }
});

最佳答案

和上面类似,我就是这样做的...

HTML:

<i class="ion-arrow-up-c rotate-90">

CSS:

.rotate-90 {
  display: inline-block; 
  transform: rotate(90deg);
}

关于javascript - 旋转页面上的 ionic 图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30857268/

相关文章:

javascript - forEach 在 JSX 中的 es6 映射

javascript - 断开或重新加载时Io套接字重置连接

javascript - 在异步操作完成之前解决 promise

css - 具有不同轮廓重量的图标 - 是否可以调整?

css - 我如何通过 CSS 转换 Ionicon?

javascript - knockout js 使用 jquery 或 javascript 更改绑定(bind)

javascript - Firebase getDownloadURL() 不返回任何内容

javascript - 如何对数组中的时间字符串求和?

angular - 如何使用 Ionic Contact 显示联系人图片

html - 在 Ionicon 图标上覆盖 'new' 横幅