mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-21 16:00:26 +01:00
Fixing viewport shuffling due to image load
Introduced new method ".loadImages()" in posts client side lib to handle viewport height changes when loading images. Requires nodebb-plugin-markdown@5.0.0 @BenLubar @boomzillawtf
This commit is contained in:
@@ -309,6 +309,23 @@
|
||||
return labels;
|
||||
},
|
||||
|
||||
/* Retrieved from http://stackoverflow.com/a/7557433 @ 27 Mar 2016 */
|
||||
isElementInViewport: function(el) {
|
||||
//special bonus for those using jQuery
|
||||
if (typeof jQuery === "function" && el instanceof jQuery) {
|
||||
el = el[0];
|
||||
}
|
||||
|
||||
var rect = el.getBoundingClientRect();
|
||||
|
||||
return (
|
||||
rect.top >= 0 &&
|
||||
rect.left >= 0 &&
|
||||
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */
|
||||
rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */
|
||||
);
|
||||
},
|
||||
|
||||
// get all the url params in a single key/value hash
|
||||
params: function(options) {
|
||||
var a, hash = {}, params;
|
||||
|
||||
Reference in New Issue
Block a user