summaryrefslogtreecommitdiff
path: root/js/refresh-on-media.js
diff options
context:
space:
mode:
authors1n <[email protected]>2020-03-28 10:31:08 -0700
committers1n <[email protected]>2020-03-28 10:31:08 -0700
commit6b81836e6b9815a2996a55ad37dcaa4d89f99e42 (patch)
tree74bb9aa78ca31a6acfffd908e34dfb0df433c707 /js/refresh-on-media.js
parentCreate .gitignore (diff)
downloadcyne.cf-backup-master.tar.xz
cyne.cf-backup-master.zip
3/28/2020, 10:30HEADmaster
Diffstat (limited to 'js/refresh-on-media.js')
-rw-r--r--js/refresh-on-media.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/js/refresh-on-media.js b/js/refresh-on-media.js
new file mode 100644
index 0000000..76bb6da
--- /dev/null
+++ b/js/refresh-on-media.js
@@ -0,0 +1,24 @@
+var context;
+var $window = $(window);
+
+// run this right away to set context
+if ($window.width() <= 768) {
+ context = 'small';
+} else if (768 < $window.width() < 970) {
+ context = 'medium';
+} else {
+ context = 'large';
+}
+
+// refresh the page only if you're crossing into a context
+// that isn't already set
+$(window).resize(function() {
+ if(($window.width() <= 768) && (context != 'small')) {
+ //refresh the page
+ location.reload();
+ } else if ((768 < $window.width() < 970) && (context != 'medium')) {
+ location.reload();
+ } else if (context != 'large') {
+ location.reload();
+ }
+});