- var width = mkws.config.responsive_design_width;
- var parent = $(".mkwsTermlists").parent();
-
- if ($(window).width() <= width &&
- parent.hasClass("mkwsTermlist-Container-wide")) {
- log("changing from wide to narrow: " + $(window).width());
- $(".mkwsTermlist-Container-wide").hide();
- $(".mkwsTermlist-Container-narrow").show();
+ var threshhold = mkws.config.responsive_design_width;
+ var width = $(window).width();
+ var from, to, method;
+
+ if (mkws.width === undefined) {
+ // No state change, since we have no previous state
+ } else if (mkws.width > threshhold && width <= threshhold) {
+ from = "wide"; to = "narrow"; method = "hide";
+ } else if (mkws.width <= threshhold && width > threshhold) {
+ from = "narrow"; to = "wide"; method = "show";
+ }
+ mkws.width = width;
+
+ if (from) {
+ log("changing from " + from + " to " + to + ": " + width);
+ $(".mkwsTermlist-Container-" + from).hide();
+ $(".mkwsTermlist-Container-" + to).show();