From 0cf8902730d1882706314630497e484286cf16dc Mon Sep 17 00:00:00 2001 From: simon987 Date: Tue, 27 Aug 2019 16:56:05 -0400 Subject: [PATCH] Load new images from the top --- index.html | 2 +- js/main.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 3a2a36e..240dea4 100644 --- a/index.html +++ b/index.html @@ -169,7 +169,7 @@ - + diff --git a/js/main.js b/js/main.js index 28310dd..80c990c 100644 --- a/js/main.js +++ b/js/main.js @@ -121,6 +121,8 @@ function connect(exchange, topics) { }; socket.onclose = (e) => { + console.log(e); + console.log(socket.CLOSED); document.getElementById("connect").innerHTML = "Disconnected"; document.getElementById("connect").classList.remove("connected"); document.getElementById("connect").classList.remove("connecting"); @@ -174,8 +176,8 @@ function createGallery(count) { function popRow() { for (let i = 0; i < colCount; i++) { if (cols[i].hasChildNodes()) { - colHeights[i] -= cols[i].firstChild.height; - cols[i].firstChild.remove(); + colHeights[i] -= cols[i].lastChild.height; + cols[i].lastChild.remove(); currentImages -= 1; } } @@ -199,7 +201,8 @@ function appendToGallery(child) { } } - cols[min].appendChild(child); + cols[min].prepend(child); + if (!child.height) { colHeights[min] += 2400 / colCount; child.onload = function () {