- 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());
+ var targetWidth = mkws.config.responsive_design_width;
+ var width = $(window).width();
+
+ if (mkws.width === undefined) {
+ // No state change, since we have no previous state
+ } else if (mkws.width > targetWidth && width <= targetWidth) {
+ log("wide -> narrow");
+ } else if (mkws.width <= targetWidth && width > targetWidth) {
+ log("narrow -> wide");
+ }
+
+ if (mkws.width > targetWidth && width <= targetWidth) {
+ log("changing from wide to narrow: " + width);