Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 表元素的jquery滑动效果_Php_Javascript_Jquery_Rotation_Autorotate - Fatal编程技术网

Php 表元素的jquery滑动效果

Php 表元素的jquery滑动效果,php,javascript,jquery,rotation,autorotate,Php,Javascript,Jquery,Rotation,Autorotate,目前,我正在我的网站上做一个列表的自动滚动功能 然而,在列表中的第一项消失后,第二项将显示第一项的“跳入位置”。我想知道的是,是否有可能使第二个项目滑入jquery中的位置,以及如何做到这一点?下面是javascript代码和html。提前谢谢你的帮助 Javascript: <script> var $target=$("tr.latest_arr td.rotate:first"); $target.animate({ marginLeft

目前,我正在我的网站上做一个列表的自动滚动功能

然而,在列表中的第一项消失后,第二项将显示第一项的“跳入位置”。我想知道的是,是否有可能使第二个项目滑入jquery中的位置,以及如何做到这一点?下面是javascript代码和html。提前谢谢你的帮助

Javascript:

    <script>
    var $target=$("tr.latest_arr td.rotate:first");
    $target.animate({
        marginLeft: -200,
        opacity: 0,
    }, function(){
        $target.css({
            marginLeft: 200
        }).appendTo('tr.latest_arr').animate({
            marginLeft: 0,
            opacity: 1
        })
    });
},5000);
    </script>

变量$target=$(“tr.latest_arr td.rotate:first”);
$target.animate({
边缘左侧:-200,
不透明度:0,
},函数(){
$target.css({
保证金左:200
}).appendTo('tr.latest_arr')。动画({
marginLeft:0,
不透明度:1
})
});
},5000);
生成的HTML(示例):

 <table>  
    <tr class="latest_arr">
       <td class="rotate" style="float:left;width:200px">Item 1</td>
       <td class="rotate" style="float:left;width:200px">Item 2</td>
       <td class="rotate" style="float:left;width:200px">Item 3</td>
       <td class="rotate" style="float:left;width:200px">Item 4</td>
       <td class="rotate" style="float:left;width:200px">Item 5</td>
            ...
            ...
            ...
    </tr>
 </table>

项目1
项目2
项目3
项目4
项目5
...
...
...
我可以对列表执行此操作,但当我将标记切换到表元素时,它会发生变化

这就是我现在面临的问题:

这是我要找的,但以表格形式:

任何帮助都将不胜感激。谢谢。

预期结果!, 我会这样做的

    var ad_refresh=setInterval(function(){
    var $target=$("ul.latest_arr li.rotate:first");
    $target.animate({
        marginLeft: -200,
        opacity: 0,
    }, function(){
        $target.css({
            marginLeft: 200
        }).appendTo('ul.latest_arr').animate({
            marginLeft: 0,
            opacity: 1
        })
    });
},1000);​

<ul class="latest_arr">
    <li class="rotate">foo1</li>
    <li class="rotate">foo2</li>
    <li class="rotate">foo3</li>
    <li class="rotate">foo4</li>
    <li class="rotate">foo5</li>
</ul>

        <style type="text/css">
         li{float:left}
        </style>​
var ad_refresh=setInterval(函数(){
var$target=$(“ul.latest_arr li.rotate:first”);
$target.animate({
边缘左侧:-200,
不透明度:0,
},函数(){
$target.css({
保证金左:200
}).appendTo('ul.latest_arr')。动画({
marginLeft:0,
不透明度:1
})
});
},1000);​
  • foo1
  • foo2
  • foo3
  • foo4
  • foo5
li{float:left} ​
结果
当然,根据您的需要更改ul css宽度将更好地处理您的案例

您究竟为什么要以表格形式执行此操作?我需要它,以便列表中的所有项目保持相同高度。嗨。对但我需要表格形式,以便我的元素保持在相同的高度。您可以使用display:blockooh为li添加固定高度。对不起。也许我说错了。让我重新措辞。我希望元素与列表中最高的元素保持相同的高度。