`
e.preventDefault();
var target = '.'+$(this).data('target');
var left = $(target).position().left;
var total = $('.front.scroll').width();
var perc = left / (total - $(window).width()) * 100;
var height = $('html').height();
var final = ((height - $(window).height())/ 100 * perc);
$('html, body').animate({scrollTop: final}, 500);
`
Scrolls the selected item to the left corner.
How to scroll to the element center?
var perc = left / (total - ($(window).width()+ $(target).width)/2 ) * 100;
Hi,
`
e.preventDefault(); var target = '.'+$(this).data('target'); var left = $(target).position().left; var total = $('.front.scroll').width(); var perc = left / (total - $(window).width()) * 100;
`
Scrolls the selected item to the left corner. How to scroll to the element center?
var perc = left / (total - ($(window).width()+ $(target).width)/2 ) * 100;
Does not do the trick BR