Search code examples
angularjsiscroll

how to scroll to accurate block with iScroll plugin for angularJs


How to scroll to the block with the id? iScroll use css rule transforms to scroll content, but this event is impossible to catch.


Solution

  • iScroll brings a function with it: http://iscrolljs.com/#indicators (scroll down to "Scrolling programmatically")

    You can scroll to a specific element (like the block with ID you mentioned) or to a specific position. Position can be x or y from left top edge of the plugin. With jQuery, you can get that position via $('#id').position().left / $('#id').position().top.