From 9e7fbdf6bf4f8d3de1abe5b4644ef3fc8f551cd9 Mon Sep 17 00:00:00 2001 From: Matthias Mees Date: Fri, 18 Apr 2014 16:51:33 +0200 Subject: [PATCH] Only fire equal heights js on screens larger than 640px. The equal heights boxes look weird on small screens, so we're not firing the plugin there any longer. This introduces a new variable for breakpoints for responsive JS. Please *only* add more breakpoints if you actually use them. References #100 --- .../2k11/admin/serendipity_editor.js.tpl | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/templates/2k11/admin/serendipity_editor.js.tpl b/templates/2k11/admin/serendipity_editor.js.tpl index abf24415..bf30b0d0 100644 --- a/templates/2k11/admin/serendipity_editor.js.tpl +++ b/templates/2k11/admin/serendipity_editor.js.tpl @@ -826,6 +826,9 @@ var AccessifyHTML5 = function (defaults, more_fixes) { }(document, jQuery)); $(function() { + // Breakpoints for responsive JS + var mq_small = matchMedia("(min-width:640px)"); + // Fire responsive nav if($('#main_menu').length > 0) { $('#nav-toggle').click(function(e) { @@ -1327,15 +1330,17 @@ $(function() { // Equal Heights $(window).load(function() { - if($('.equal_heights').length > 0) { - if($('html').hasClass('lt-ie9')) { - $('.equal_heights').syncHeight({ - updateOnResize: false - }); - } else { - $('.equal_heights').syncHeight({ - updateOnResize: true - }); + if (mq_small.matches) { + if($('.equal_heights').length > 0) { + if($('html').hasClass('lt-ie9')) { + $('.equal_heights').syncHeight({ + updateOnResize: false + }); + } else { + $('.equal_heights').syncHeight({ + updateOnResize: true + }); + } } } });