需要jQuery代码来旋转整个div [英] Need Jquery code for rotate a whole div

查看:78
本文介绍了需要jQuery代码来旋转整个div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一套菜单.我需要垂直旋转(-90度).现在我有一些代码,但现在无法正常工作.帮帮我

I have set of menu. i need to rotate vertically (-90 degree). Now i have some code but it not working now. Help me

   $(document).ready(function() {
              $('#tabs').rotate(-90);
              });

谢谢

Bhavan

推荐答案

您可以使用CSS3的转换规则来旋转​​事物,这些规则是特定于浏览器的(即使它们具有相同的语法). 因此,jQuery团队决定在它成为标准时才处理此问题.

You can rotate things using CSS3's transform rules, which are browser specific (even if they have the same syntax). For this reason, the jQuery team decided to not handle this until this when it becomes standard.

因此,基本上,您可以做的是在CSS中创建一个旋转类的类,然后使用jQuery将该类添加到您的元素中.

So basically, what you can do is to create a class in your CSS that rotate things and then, with jQuery add that class to your element.

CSS:

.rotate {
    -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    -ms-transform: rotate(90deg);
    transform: rotate(90deg);
}

jQuery:

$(document).ready(function(){
    $('.foo').addClass('rotate');
}):

或者,但我不会朝这个方向发展,有很多插件可以向jQuery添加旋转支持.

Alternatively, but I'd not go into this direction, there are a lot of plugins that are able to add rotate support to jQuery.

这篇关于需要jQuery代码来旋转整个div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆