📜 ⬆️ ⬇️

Smooth scrolling in Opera

$("html:not(:animated), body:not(:animated)").animate({scrollTop: $(this).position().top});

When using this code in opera, scrolling does not start from the current position, but from the very top of the page, a very unpleasant effect. Example

You can fix this if you leave the animation only for html:
$("html:not(:animated)"+( ! $.browser.opera ? ",body:not(:animated)" : "")).animate({scrollTop: $(this).position().top});
Example 2

')

Source: https://habr.com/ru/post/65068/


All Articles