jQuery .rotate() doesn't work

一笑奈何 提交于 2020-06-23 18:36:26

问题


I don't know why it don't work. I am using jQuery 2.1.0

I have this code:

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

How can I make it work without using a plugin?


回答1:


for using .rotate(), you need to add jqueryrotate plugin. This can be also achieved using pure jQuery and CSS.

Try this:

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



回答2:


Use .css() in jquery

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


来源:https://stackoverflow.com/questions/23338620/jquery-rotate-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!