Scroll to Previous and Next Sections Based on Current Location


I have long content that has a section, followed by multiple paragraphs and then another section, etc.

I would like to have previous and next buttons on the footer that allow the user to scroll to the previous and next section. I think the $ionicScrollDelegate.scrollTop can be used for this but the user might be manually scrolling through the content and when the next section button is clicked, I want them to go to the next section based where they currently are located.

Any suggestions on how to accomplish this?


You may want to check out scrollTo() and scrollBy(), which can let you scroll by pixel values. scrollBy() seems like it could be the best solution for you.

$ = function(){
  $ionicScrollDelegate.scrollBy(0, 30, true)

This function will make ion-content scroll by 30$ionicScrollDelegate/