From: Mike Taylor Date: Wed, 10 Jul 2013 11:50:21 +0000 (+0100) Subject: Change mkws_mobile_resize(): X-Git-Tag: 0.9.1~275^2~13 X-Git-Url: http://jsfdemo.indexdata.com/?a=commitdiff_plain;h=417616ae68f17377347f773f30d8fc5822a2d0e8;p=mkws-moved-to-github.git Change mkws_mobile_resize(): - only fire when switching between wide and narrow - work by moving a div, not copying its contents --- 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(""); } };