In a div i am putting some divs and i set overflow: hidden. Main div can show five sub divs after that i need to scroll to see rest of the divs. To scroll down i created a div and on click function of that div i am scrolling rest of div. Code for this is following:
if(whatsupobj.length > 5){
$('#scrolldown').click(function(){
var toppx = whatsupobj.length-1;
var lastdivtoppx = '268px';
if($('#subdiv'+toppx).css('top') !== lastdivtoppx ){
$(".subdiv").animate({"top": "-=67px"}, "medium");
}
});
$('#scrollup').click(function(){
if($('#subdiv0').css('top') !== '0px' ){
$(".subdiv").animate({"top": "+=67px"}, "medium");
}
});
}else{
$('#scrollup').unbind("click");
$('#scrolldown').unbind("click");
}
its working fine with only one problem. Problem is that when i click on scrolldown very fast then sub divs keep going down. But when i click on scrolldown normally then it stops when last div shows itself. I know i can increase or decrease the animation speed but it doesn't look good when its fast. How can i fix this problem? Thanks in advance.