Skip to content

Node.js based forum software built for the modern web

fixed responsive pie charts

psychobunny8c9d36253502
diff --git a/public/src/forum/admin/general/dashboard.js b/public/src/forum/admin/general/dashboard.js
index 51eefc0f5b..137bc4ba2a 100644
--- a/public/src/forum/admin/general/dashboard.js
+++ b/public/src/forum/admin/general/dashboard.js
@@ -277,16 +277,19 @@ define('forum/admin/general/dashboard', ['semver'], function(semver) {
setInterval(updateTrafficGraph, 15000);
updateTrafficGraph();
- $(window).on('resize', function() {
- $('.pie-chart.legend-up').each(function() {
- var $this = $(this);
+ $(window).on('resize', adjustPieCharts);
+ adjustPieCharts();
+ }
- if ($this.width() < 320) {
- $this.addClass('compact');
- } else {
- $this.removeClass('compact');
- }
- });
+ function adjustPieCharts() {
+ $('.pie-chart.legend-up').each(function() {
+ var $this = $(this);
+
+ if ($this.width() < 320) {
+ $this.addClass('compact');
+ } else {
+ $this.removeClass('compact');
+ }
});
}