I need to make sure that the scrool of the mouse is running down, it follows a line to the side, this I was able to do, as I show in the link below
My difficulty is when you open the page and Two Lines already appears, how can I open the site and first line only ?
$(document).ready(function(){
var count;
$('#servicos ul li.bloco').each(function( index ) {
count = index;
});
$(window).scroll(function (event) {
var scroll = $(window).scrollTop();
var item = $('#servicos ul').offset().top;
if( (scroll+400) > item ){
animSvg( $('.svg') );
}
$('#servicos ul li.bloco').each(function( index ) {
if( index < (count+1) ){
var item = $(this).offset().top;
var anim = $(this).find('.svg-lista');
if( (scroll+200) > item ){
var ativo = $('.label_serv a').children('li').eq(index);
$('.label_serv a li').removeClass('active');
ativo.addClass('active');
animSvg( anim );
}
}
});
});
});
function animSvg(obj){
var val = obj.data('to');
var dist = obj.scrollTop();
obj.animate({
'stroke-dasharray': val
}, 1000, function() {
/*fim*/
});
}
function scrollCustom(id){
var offset = $('#header_titulo').height();
$('html, body').animate({scrollTop:$('#' + id).position().top + offset}, 'slow');
}