How to do animated scroll window to top or offset of particular element

Whenever you want to do animated scroll using a particular html element as a offset you can use the following jQuery code where -100 it the offset from the element in pixels.

Also if you would like to have the option for scrolling to the toп of your page use this one: