【问题标题】:jQuery .rotate() doesn't workjQuery .rotate() 不起作用
【发布时间】:2014-06-13 20:29:30
【问题描述】:

我不知道为什么它不起作用。我正在使用 jQuery 2.1.0

我有这个代码:

$("a.shownav img").rotate(180);

如何在不使用插件的情况下使其工作?

【问题讨论】:

标签: jquery css rotation css-transforms


【解决方案1】:

使用.rotate(),需要添加jqueryrotate插件。这也可以使用纯 jQuery 和 CSS 来实现。

试试这个:

$("a.shownav img").css({
    "-webkit-transform": "rotate(180deg)",
    "-moz-transform": "rotate(180deg)",
    "transform": "rotate(180deg)" /* For modern browsers(CSS3)  */
});

【讨论】:

【解决方案2】:

在 jquery 中使用 .css()

$("a.shownav img").css("transform", "rotate(180deg)");

【讨论】:

  • jquery 中没有使用 css 的旋转方法,只有我们可以实现这一点
猜你喜欢
  • 2016-06-30
  • 2018-06-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-12-14
  • 2013-09-05
  • 2012-01-25
相关资源
最近更新 更多