2

I am using jquery for smooth scroll this way

 $('.parent-class').animate({
  scrollTop: $('#scrllhere').offset().top + 10
}, 800);

Goal here is on click, i am calling one function based on certain condition i am using above code for scroll this is working fine but i want to achieve same using angular 5 animation without using jquery.

my function is like this

  smoothScroll(){
        $('.parent-class').animate({
        scrollTop: $('#scrllhere').offset().top + 10
    }, 800);

  }

Now i want to achieve same thing without using jquery

After going through angular5 animation docs https://angular.io/guide/animations

I am little confused how to use animate() on the fly for scrolling Note that there is no state change involved just scrolling

Edit: Even solution in Javascript without using jquery is fine.

Thanks

Vicky Kumar
  • 1,358
  • 1
  • 14
  • 26

0 Answers0