I want to show as soon as I start scrolling. Don"t wait a few seconds to display the value of
.
ask for advice
<script>
$(function(){
var scrollDiv = $(".scroll"),
$ul = scrollDiv.find("ul"),
$li = scrollDiv.find("li"),
$length = $li.length,
$liHeight = $li.height(),
num = 2;
if(scrollDiv.length == 0){
return;
}
if($length > 1){
$ul.append($li.eq(0).clone());
setInterval(
function(){
numPP;
$ul.addClass("animate").css("-webkit-transform","translateY(-"+ $liHeight*(num) +"px)");
setTimeout(
function(){
if(num == $length){
$ul.removeClass("animate").css("-webkit-transform","translateY(-70px)");
num = 2;
}
},3000);
},3000);
}
});
</script>