I have a some <div>
with contents and a <body>
which is vertically scrollable.
If whole div is currently visible in browser view-port, I don't wish to do anything.
If div is partially visible and only upper part visible, I wish to scroll the body downward to display the whole div.
If div is partially visible and only lower part visible, I wish to scroll the body upward to display the whole div.
How to do this using jQuery?
How to calculate if div is partially or fully visible?
How to calculate scroll direction and amount to scroll if div is partially visible?
Note: Ignore the case when the height of the div is greater than browser view-port height.