Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function scroll_to_if_not_visible(finder) {
- var postop = $(finder).offset().top, win = $(window);
- var posbottom = postop + $(finder).height();
- if (posbottom > (win.height() + win.scrollTop())) {
- $(finder).get(0).scrollIntoView(false);
- }
- else if (postop < win.scrollTop()) {
- $(finder).get(0).scrollIntoView(true);
- }
- }
Add Comment
Please, Sign In to add comment