From b9c5ab537a2279480f44d69eae2358086468771b Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 30 Apr 2014 16:51:49 +0100 Subject: [PATCH] Detection of wide/narrow state changes is now done on the basis of the stored mkws.width rather than the presence of absence of known magic elements. --- src/mkws-core.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/mkws-core.js b/src/mkws-core.js index 8d19f3a..20eab4d 100644 --- a/src/mkws-core.js +++ b/src/mkws-core.js @@ -332,7 +332,6 @@ mkws.pagerNext = function(tname) { function resizePage() { var list = ["mkwsSwitch", "mkwsLang"]; - var parent = $(".mkwsTermlists").parent(); var targetWidth = mkws.config.responsive_design_width; var width = $(window).width(); @@ -347,10 +346,8 @@ mkws.pagerNext = function(tname) { } else { log("already narrow"); } - mkws.width = width; - if (width <= targetWidth && - parent.hasClass("mkwsTermlist-Container-wide")) { + if (mkws.width > targetWidth && width <= targetWidth) { log("changing from wide to narrow: " + width); $(".mkwsTermlist-Container-wide").hide(); $(".mkwsTermlist-Container-narrow").show(); @@ -361,8 +358,7 @@ mkws.pagerNext = function(tname) { $("." + list[i] + ".mkwsTeam_" + tname).hide(); } } - } else if (width > targetWidth && - parent.hasClass("mkwsTermlist-Container-narrow")) { + } else if (mkws.width <= targetWidth && width > targetWidth) { log("changing from narrow to wide: " + width); $(".mkwsTermlist-Container-wide").show(); $(".mkwsTermlist-Container-narrow").hide(); @@ -374,6 +370,8 @@ mkws.pagerNext = function(tname) { } } } + + mkws.width = width; }; -- 1.7.10.4