Skip to content

Commit

Permalink
added progress spinner to trending page
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketMan committed Dec 12, 2024
1 parent 8d68272 commit f97848c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
39 changes: 39 additions & 0 deletions css/trending.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,42 @@ div.jqcloud {
}

div.jqcloud span { padding: 4px; }

/* loading */

@keyframes loading {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.loading {
position: absolute;
height: 100%;
aspect-ratio: 1 / 1;
display: flex;
justify-content: center;
align-items: center;
top: 0;
left: 0;
}
.loading div {
width: 33%;
height: 33%;
max-width: 33%;
max-height: 33%;
}
.loading div::after {
content: "";
margin: -4px;
width: 100%;
height: 100%;
display: block;
border-style: solid;
border-width: 6px;
border-color: #ccc transparent transparent #ccc;
border-radius: 100%;
animation: 1s linear 0s infinite normal none running loading;
}
12 changes: 12 additions & 0 deletions js/trending.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ function reposition() {
.css('opacity', 1)
.parent().css('overflow-x','clip');

$(".loading").remove();

loading = false;
}

Expand All @@ -52,6 +54,12 @@ function loadCloud() {
if(Math.abs(lastsize - width) < 10)
return;

if($(".loading").length == 0) {
$(".content").append($("<div>", {
class: "loading"
}).append($("<div>")));
}

loading = true;
lastsize = width;
$("#cloud").css('opacity', 0).empty().jQCloud(trending, {
Expand All @@ -71,6 +79,10 @@ $().ready(function() {
return;
}

$(".content").append($("<div>", {
class: "loading"
}).append($("<div>")));

$.ajax({
dataType: 'json',
type: 'GET',
Expand Down

0 comments on commit f97848c

Please sign in to comment.