Open alexkingorg opened 12 years ago
Nice, thank you! That was exactly what I was looking for. A offset: center
would probably also be useful (scrolling the element so it's vertically centered within the visible area of the screen).
:+1:
+1 to merging in (and documenting) this!
Wouldn't offset: middle
be more in line with vertical centering?
For me, this isn't about centering. Rather is it about having a slight buffer so that the scrolled-to-item isn't immediately flush with the edge of the container (making it a hair more visually pleasing).
Not sure if this would be valuable to you as part of the main codeline or not, but for my needs I wanted to be able to define an "offset" - a buffer by which I wanted to the element being scrolled into view to be away from the edge of the browser.
I've only implemented this in the vertical settings for now (additional option of "offset"), but it would be pretty easy to add to the horizontal as well. If you'd like me to clean it up for you, let me know and I'll give it a shot. If you want to rewrite it in your own hand, that's perfectly fine as well.
I hope this is useful and thanks for the very useful plugin!