jquery hide element in scroll

139 views Asked by At

I create horizontal scroller for run to the left and right the elements inside content , my script it´s this :

<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>

I try something as this :

if ($item>=visible)
{
jQuery(".productos_items").css("display","none")
}

But no works

The problem it´s i can´t get hide the elements , for example i put visible first 3 items and after this i want hide the others and when push to the right show this and hide the other

I try different things but i can´t get this finally

Thank´s

1

There are 1 answers

0
iKBAHT On

try this:

if ($item.length >= visible)    {
    $item.hide()
}