【发布时间】:2013-10-26 20:06:03
【问题描述】:
我创建水平滚动条来左右移动内容内的元素,我的脚本是这样的:
<script>
jQuery(document).ready(function()
{
var $item = jQuery(".productos_items"),
visible = 3,
index = 0,
endIndex=($item.length/visible)-1;
jQuery('#productos_arrowR').click(function(){
if(index < endIndex ){
index++;
$item.animate({'left':'-=100px'});
}
});
jQuery('#productos_arrowL').click(function(){
if(index > 0){
index--;
$item.animate({'left':'+=100px'});
}
});
});
</script>
我尝试这样做:
if ($item>=visible)
{
jQuery(".productos_items").css("display","none")
}
但没有工作
问题是我无法隐藏元素,例如我放了前 3 个可见的项目,然后我想隐藏其他的,当推到右边时显示这个并隐藏另一个
我尝试了不同的东西,但我最终无法得到这个
谢谢
【问题讨论】:
-
没有什么可以帮助我?
标签: javascript jquery jquery-animate jquery-scrollable