bootstrap-multiselect.min.js
2 months ago
jquery.liveFilter.js
2 months ago
jquery.liveFilter.min.js
2 months ago
jquery.widgetopts.beaver.js
2 months ago
jquery.widgetopts.beaver.min.js
2 months ago
select2-settings.js
2 months ago
select2-settings.min.js
2 months ago
select2.min.js
2 months ago
settings.js
2 months ago
settings.min.js
2 months ago
widgetopts.global.js
2 months ago
widgetopts.migration.js
2 months ago
widgetopts.resize.js
2 months ago
widgets.js
2 months ago
widgets.min.js
2 months ago
wpWidgetOpts.js
2 months ago
wpWidgetOpts.min.js
2 months ago
widgetopts.resize.js
46 lines
| 1 | (function () { |
| 2 | // Define breakpoints for mobile, tablet, and desktop |
| 3 | const mobileBreakpoint = 767; |
| 4 | const tabletBreakpoint = 1024; |
| 5 | |
| 6 | let previousDeviceCategory = ""; // To store the previous window size category |
| 7 | |
| 8 | // Function to detect device size category |
| 9 | function getDeviceCategory() { |
| 10 | const width = window.innerWidth; |
| 11 | |
| 12 | if (width <= mobileBreakpoint) { |
| 13 | return "mobile"; |
| 14 | } else if (width > mobileBreakpoint && width <= tabletBreakpoint) { |
| 15 | return "tablet"; |
| 16 | } else { |
| 17 | return "desktop"; |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | // Function to check for window resize and refresh if needed |
| 22 | function checkWindowSize() { |
| 23 | const currentDeviceCategory = getDeviceCategory(); |
| 24 | |
| 25 | // Compare with the previous device category |
| 26 | if (currentDeviceCategory !== previousDeviceCategory) { |
| 27 | previousDeviceCategory = currentDeviceCategory; // Update the previous category |
| 28 | location.reload(); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | document.addEventListener("DOMContentLoaded", function () { |
| 33 | let resizeTimeout; |
| 34 | |
| 35 | function checkWindowSizeDebounced() { |
| 36 | clearTimeout(resizeTimeout); |
| 37 | resizeTimeout = setTimeout(checkWindowSize, 200); // 200ms delay |
| 38 | } |
| 39 | |
| 40 | // Initial detection when the page loads |
| 41 | previousDeviceCategory = getDeviceCategory(); |
| 42 | |
| 43 | window.addEventListener("resize", checkWindowSizeDebounced); |
| 44 | }); |
| 45 | })(); |
| 46 |