From 49040bb1c57492fdab9c15bd397c8885e3343d43 Mon Sep 17 00:00:00 2001 From: Jim Mason Date: Fri, 13 Dec 2024 13:03:20 +0000 Subject: [PATCH] added comment (non-semantic change) --- css/trending.css | 6 +++--- js/trending.js | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/css/trending.css b/css/trending.css index 44987a07..9518c16f 100644 --- a/css/trending.css +++ b/css/trending.css @@ -53,9 +53,9 @@ div.jqcloud { div.jqcloud span { padding: 4px; } div.jqcloud.invisible { - position: absolute; - top: -9999px; - left: -9999px; + position: absolute; + top: -9999px; + left: -9999px; } /* loading */ diff --git a/js/trending.js b/js/trending.js index f25e65d6..43ce89d2 100644 --- a/js/trending.js +++ b/js/trending.js @@ -28,6 +28,7 @@ var lastsize = 0; var timeout; function reposition() { + // determine the left and top edges of the word cloud var pos = loading.children('span').toArray().reduce(function(carry, span) { if(span.offsetLeft < carry.left) carry.left = span.offsetLeft; @@ -36,6 +37,7 @@ function reposition() { return carry; }, { left: 10000, top: 10000 } ); + // reposition the word cloud to the upper left of the content area loading.css('margin-left', -pos.left + 'px') .css('margin-top', -pos.top+20 + 'px'); @@ -51,6 +53,7 @@ function reposition() { function loadCloud() { if(trending && !loading) { var content = $(".content"); + // shrink slightly to ensure we remain within the container var width = content.outerWidth() - 50; var height = content.outerHeight() - 50; @@ -61,6 +64,11 @@ function loadCloud() { lastsize = width; + // The div must be in the DOM *and* visible for jQCloud. + // + // We absolute position the div offscreen (class 'invisible'), + // let jQCloud do the layout, and then reposition the div into + // the normal document flow upon completion. loading = $("
", { class: "jqcloud invisible" });