Skip to content

Commit

Permalink
fixed to avoid cloud re-layout on trivial resize
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketMan committed Dec 11, 2024
1 parent c3694e1 commit 8d68272
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/trending.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

var trending = null;
var loading = false;
var lastsize = 0;
var timeout;

function reposition() {
Expand All @@ -45,8 +46,14 @@ function reposition() {

function loadCloud() {
if(trending && !loading) {
loading = true;
var width = $(".content").outerWidth();

// avoid re-layout on trivial resize
if(Math.abs(lastsize - width) < 10)
return;

loading = true;
lastsize = width;
$("#cloud").css('opacity', 0).empty().jQCloud(trending, {
width: width,
height: 350,
Expand Down

0 comments on commit 8d68272

Please sign in to comment.