-webkit-transform 旋转问题

发布于 2024-11-08 03:58:25 字数 960 浏览 0 评论 0原文

好吧,我几乎查看了该网站上的所有轮换条目,但无法解决此问题。已经花了整整三天的时间试图弄清楚。这很可能是非常简单的事情,但我就是无法理解。问题是:我有 2 个具有旋转控件的图像。但是,当我旋转 1 时,它们都会旋转。我希望它们不要同时旋转,而是单独旋转。您可以在这里看到它: http://dl.dropbox.com/u/11770605/sample2 .html

这是 main.js 的以下代码:

    $(document).ready(function(){ $('.cc-element').rotatable(); });

这是标记:

    <span id="cc-element-1" class="cc-element ui-draggable cc-active" style="-webkit-transform: rotate(0deg);" ><image goes here></span>

我也尝试过:

    $(document).ready(function(){
    $('.cc-element').rotatable();
    $('.cc-element2').rotatable();
    });

    <span id="cc-element-2" class="cc-element ui-draggable cc-active" style="-webkit-transform: rotate(0deg);" > <image goes here>< /span>

该修改不起作用。请帮助我,我必须尽快解决这个问题。

Ok, I've looked at virtually all of the rotation entries on this site and just cannot solve this. It has been 3 full days of trying to figure it out. More than likely it is something very simple but I just cannot get it. Here's the issue: I have 2 images that have rotate controls. However, when I go to rotate 1, they both rotate. I want them not to rotate simultaneously, but rather, on their own. You can see it here: http://dl.dropbox.com/u/11770605/sample2.html

Here's the following code for main.js:

    $(document).ready(function(){ $('.cc-element').rotatable(); });

and here's the markup:

    <span id="cc-element-1" class="cc-element ui-draggable cc-active" style="-webkit-transform: rotate(0deg);" ><image goes here></span>

I've also tried:

    $(document).ready(function(){
    $('.cc-element').rotatable();
    $('.cc-element2').rotatable();
    });

and

    <span id="cc-element-2" class="cc-element ui-draggable cc-active" style="-webkit-transform: rotate(0deg);" > <image goes here>< /span>

but that modification did NOT work. Please, help me, I MUST get this fixed asap.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

童话 2024-11-15 03:58:25

问题是你的“rotatable()”插件对传递给它的 this 值进行操作,当你的选择器是“.cc-element”时,该值将是一个列表两个元素。因此,您对“roll()”插件的调用对整个列表进行操作。

您需要将该插件中的适当代码包装在“each()”迭代器中。像这样的东西:

    $.fn.rotatable = function() {
      return this.each(function() {
        var $this = $(this),
          // ... the rest of the plugin, as it is now ...
      });
    };

The problem is that your "rotatable()" plugin operates on the this value passed to it, which when your selector is ".cc-element" will be a list of both elements. Thus, your calls to the "roll()" plugin operate on the whole list.

You need to wrap appropriate code in that plugin in an "each()" iterator. Something like:

    $.fn.rotatable = function() {
      return this.each(function() {
        var $this = $(this),
          // ... the rest of the plugin, as it is now ...
      });
    };
渔村楼浪 2024-11-15 03:58:25

您正在按类别选择元素,并且它们都具有相同的类别。像这样改变它:

$(document).ready(function(){
    $('#cc-element').rotatable();
    $('#cc-element2').rotatable();
    });

you are selecting the elements by class and they both have the same class. Change it like this:

$(document).ready(function(){
    $('#cc-element').rotatable();
    $('#cc-element2').rotatable();
    });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文