Open diegocanal opened 5 years ago
Hi Diego!
This seems fine to me. 2 questions:
20
, so the code would read:
speed = (delta + (1000 * opts.newOption) / opts.autoCoefficient;
thoughts?
Hi Karl!
I appreciate you have taken the suggestion into consideration.
Answering your questions:
Thanks!
Hi Karl,
When having very long pages the
(current scroll position - target scroll position) / autoCoefficient
formula does not provide us with enough control to get a reasonable balance between anchor links that have their targets very close to them and the ones that have their targets far away from them, i.e., If:autoCoefficient
is set to a low value, when anchor links with distant targets are clicked, the resulting smooth scrolling is painfully slow.autoCoefficient
is set to a value high enough to fix the aforementioned slowness, when anchor links with closer targets are clicked, the resulting smooth scrolling is too fast –almost seems instantaneous (as if it wasn't smooth)–.I suggest to create an extra option, apart from
autoCoefficient
so we'd end up with the formula:(current scroll position - target scroll position + NewOption) / autoCoefficient
I've tried it and it works much better, for example, for
autoCoefficient: 9
I have modified the code into:You can see it in action here: 28 ejemplos de modificación de medidas por un abogado en Madrid. Please, try the anchor links:
Thanks!