mirror of
https://github.com/pinry/pinry.git
synced 2025-11-17 18:30:39 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user