miromannino/Justified-Gallery

JG blocks scrollTop()?

jefftucker1952 opened this issue · 1 comments

I've put a little script on some pages so that, if the visitor leaves the page, then returns, his original scroll position is retained:

function retainPos() {
	var pathName = document.location.pathname;
	window.onbeforeunload = function () {
		var scrollPosition = $(document).scrollTop();
		sessionStorage.setItem("scrollPosition_" + pathName, scrollPosition.toString());
	}
	if (sessionStorage["scrollPosition_" + pathName]) {
		$(document).scrollTop(sessionStorage.getItem("scrollPosition_" + pathName));
	}
};
$(document).ready(retainPos);

Works just fine on a simple page of thumbnails. But if I use Justified-Gallery, it no longer works. I can't figure out what JG is doing that interferes with this simple mechanism.

Can anyone suggest where I should be looking?

Never mind. I need to get a callback from jg.complete, so this is just a code engineering problem.