Don't load Pins "in background" when lightbox is active.

Remove the scroll event handler when lightbox is active, so pins are
not loaded in background breaking the page layout.
This commit is contained in:
Krzysztof Klimonda
2013-04-14 15:51:39 +02:00
parent cecc88f068
commit defbd50445
2 changed files with 19 additions and 5 deletions

View File

@@ -22,12 +22,22 @@ $(window).load(function() {
'margin-top': -$('body').data('scroll-level')
});
$(window).scrollTop(0);
/* disable the global pin-loading scroll handler so we don't
load pins when scrolling a selected image */
$(window).off('scroll');
} else {
$('#pins').css({
'position': 'static',
'margin-top': 0
});
$(window).scrollTop($('body').data('scroll-level'));
/* enable the pin-loading scroll handler unless we've already
loaded all pins from the server (in which case an element
with id 'the-end' exists */
var theEnd = document.getElementById('the-end');
if (!theEnd) {
$(window).scroll(scrollHandler);
}
}
}
// End Helper Functions