【问题标题】:jQuery - Cycle Plugin - Image PositioningjQuery - 循环插件 - 图像定位
【发布时间】:2009-12-11 11:15:49
【问题描述】:

我正在使用 jQuery Cycle 插件在 site 上旋转一系列图像。这些图像在 Safari 中看起来不错,但在 Firefox 中它们在顶部偏离了大约 4 个像素。显然,与那里的相交线保持正确的定位是相当关键的。

我希望能在定位该元素方面提供一些帮助,以便 cycle.js 不会移动它。

谢谢。

【问题讨论】:

    标签: jquery cycle


    【解决方案1】:

    原来是浮动元素和循环代码的绝对定位冲突。

    我将其替换为另一种实际上可以正常工作的解决方案。

    <script type="text/javascript">
    $(function(){
            setInterval("rotateImages()", 4000 );
        });
    
        function rotateImages() {
            var oCurPhoto = $("#slideshow div.current");
            var oNxtPhoto = oCurPhoto.next();
            if (oNxtPhoto.length == 0)
                oNxtPhoto = $("#slideshow div:first");
    
            oCurPhoto.removeClass('current').addClass('previous');
            oNxtPhoto.css({ opacity: 0.0 }).addClass('current').animate({ opacity: 1.0 }, 2000, 
                function() {
                    oCurPhoto.removeClass('previous');
                }); 
    }
    </script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多