I am experimenting with creating a scrolling animation using mCustomScrollbar
Currently, I have managed to obtain the current scrollTop
and animate it to a specific height using the code below:
$("#content").mCustomScrollbar({
scrollButtons:{
enable:true
},
advanced:{
updateOnContentResize: true,
updateOnBrowserResize: true,
},
callbacks:{
onScrollStart:function(){ onScrollStart(); },
whileScrolling:function(){ WhileScrolling(); }
}
});
function WhileScrolling(){
var top = Math.abs(mcs.top);
if(top > 180){
$('#topbar').animate({opacity:'0'});
}
However, when I attempt to reverse the animation with the following code:
if(top < 180){
$('#topbar').animate({opacity:'1'});
}
This section fails, and once included, the animate({opacity:0})
seems to have a delayed start before initiating the animation.
Here is a preview: