0

content 内の要素を左右に実行するための水平スクローラーを作成します。私のスクリプトは次のとおりです。

<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 つのアイテムを表示し、その後、他のアイテムを非表示にして、右に押すとこれを表示し、他のアイテムを非表示にします。

いろいろやってみるが結局これにならない

ありがとう

4

1 に答える 1

0

これを試して:

if ($item.length >= visible)    {
    $item.hide()
}
于 2013-10-28T08:26:02.380 に答える