From: Mike Taylor Date: Wed, 30 Apr 2014 15:51:49 +0000 (+0100) Subject: Detection of wide/narrow state changes is now done on the basis of the X-Git-Tag: 1.0.0~776 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=b9c5ab537a2279480f44d69eae2358086468771b;p=mkws-moved-to-github.git 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. --- 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; };