--- loncom/interface/lonhtmlcommon.pm 2013/07/10 22:07:37 1.349 +++ loncom/interface/lonhtmlcommon.pm 2013/07/11 18:25:51 1.350 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.349 2013/07/10 22:07:37 raeburn Exp $ +# $Id: lonhtmlcommon.pm,v 1.350 2013/07/11 18:25:51 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2942,10 +2942,7 @@ sub resize_scrollbox_js { scroll => 'contentscroll', boxh => 'contenteditor', ); - $paddingwfrac = 0; - unless ($env{'browser.mobile'}) { - $paddingwfrac = 0.09; - } + $paddingwfrac = 0.09; $offsetwfrac = 0.015; $offsetv = 20; $minw = 250; @@ -2984,6 +2981,7 @@ function resize_scrollbox(scrollboxname, var scrolltableid = 'table_'+scrollboxname; var scrollbox; var scrolltable; + var ismobile = '$env{'browser.mobile'}'; if (document.getElementById("$names{'boxw'}") == null) { return; @@ -3020,6 +3018,7 @@ FIRST } $output .= <<"SECOND"; var listwchange; + var scrollchange; if (chkw == 1) { var boxw = document.getElementById("$names{'boxw'}").offsetWidth; var itemw; @@ -3031,6 +3030,7 @@ FIRST var scrollboxw = scrollbox.offsetWidth; var scrollboxscrollw = scrollbox.scrollWidth; + var scrollstart = scrollboxw; var offsetw = parseInt(vpw * $offsetwfrac); var paddingw = parseInt(vpw * $paddingwfrac); @@ -3105,11 +3105,19 @@ PARAMSONE } } + if (newscrollboxw != scrollboxw) { + scrollchange = 1; + } + if (itemid.offsetWidth != itemwstart) { listwchange = 1; } } if ((chkh == 1) || (listwchange)) { + var itemid = document.getElementById("$names{'item'}"); + if (itemid != null) { + itemh = itemid.offsetHeight; + } var primaryheight = document.getElementById('LC_nav_bar').offsetHeight; var secondaryheight; if (document.getElementById('LC_secondary_menu') != null) { @@ -3130,6 +3138,7 @@ PARAMSONE var scrollboxheight = scrollbox.offsetHeight; var scrollboxscrollheight = scrollbox.scrollHeight; + var scrollboxh = scrollboxheight; var minvscrollbox = $minv; var offsetv = $offsetv; @@ -3160,6 +3169,13 @@ PARAMSONE scrollbox.style.height = newscrollheight+"px"; } } + var newscrollboxh = scrollbox.offsetHeight; + if (scrollboxh != newscrollboxh) { + scrollchange = 1; + } + } + if (ismobile && scrollchange) { + \$("#div_$names{'scroll'}").getNiceScroll().onResize(); } return; }