From 417616ae68f17377347f773f30d8fc5822a2d0e8 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 10 Jul 2013 12:50:21 +0100 Subject: [PATCH] Change mkws_mobile_resize(): - only fire when switching between wide and narrow - work by moving a div, not copying its contents --- tools/htdocs/mkws.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 57bc3f5..7827b68 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -583,7 +583,7 @@ function mkws_html_all(config) { $("#mkwsResults").html('\ \ \ - \ \ \ + \ + \ + \
\ + \
\
\ @@ -593,6 +593,11 @@ function mkws_html_all(config) {
\
\ +
\ +
'); } @@ -781,27 +786,28 @@ function mkws_html_lang(mkws_config) { } function mkws_mobile_resize () { - debug("resize width: " + $(window).height() + ", width: " + $(window).width()); + debug("resize height: " + $(window).height() + ", width: " + $(window).width()); var list = ["mkwsSwitch"]; var obj; // alert($(window).width()); var width = mkws_config.responsive_design_width || 980; + var parentId = $("#mkwsTermlists").parent().attr('id'); - if ($(window).width() <= width) { + if ($(window).width() <= width && + parentId === "mkwsTermlistContainer1") { + debug("changing from wide to narrow"); + $("#mkwsTermlists").appendTo($("#mkwsTermlistContainer2")); for(var i = 0; i < list.length; i++) { $("#" + list[i]).hide(); } - - $("#mkwsTermlists").hide(); - obj = $("#mkwsTermlists").html(); - $("#mkwsShiftedTermlists").html(obj); - } else { + } else if ($(window).width() > width && + parentId === "mkwsTermlistContainer2") { + debug("changing from narrow to wide"); + $("#mkwsTermlists").appendTo($("#mkwsTermlistContainer1")); for(var i = 0; i < list.length; i++) { $("#" + list[i]).show(); } - $("#mkwsTermlists").show(); - $("#mkwsShiftedTermlists").html(""); } }; -- 1.7.10.4