[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm
raeburn
raeburn at source.lon-capa.org
Thu Jul 11 14:25:51 EDT 2013
raeburn Thu Jul 11 18:25:51 2013 EDT
Modified files:
/loncom/interface lonhtmlcommon.pm
Log:
- jquery.nicescroll used for scrolling in div scrollboxes on mobile devices
- javascript function resize_scrollbox() includes call to
getNiceScroll().onResize() for scrollbox div, if size changed and
browser.mobile set.
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.349 loncom/interface/lonhtmlcommon.pm:1.350
--- loncom/interface/lonhtmlcommon.pm:1.349 Wed Jul 10 22:07:37 2013
+++ loncom/interface/lonhtmlcommon.pm Thu Jul 11 18:25:51 2013
@@ -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 @@
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 @@
var scrolltableid = 'table_'+scrollboxname;
var scrollbox;
var scrolltable;
+ var ismobile = '$env{'browser.mobile'}';
if (document.getElementById("$names{'boxw'}") == null) {
return;
@@ -3020,6 +3018,7 @@
}
$output .= <<"SECOND";
var listwchange;
+ var scrollchange;
if (chkw == 1) {
var boxw = document.getElementById("$names{'boxw'}").offsetWidth;
var itemw;
@@ -3031,6 +3030,7 @@
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 @@
}
}
+ 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 @@
var scrollboxheight = scrollbox.offsetHeight;
var scrollboxscrollheight = scrollbox.scrollHeight;
+ var scrollboxh = scrollboxheight;
var minvscrollbox = $minv;
var offsetv = $offsetv;
@@ -3160,6 +3169,13 @@
scrollbox.style.height = newscrollheight+"px";
}
}
+ var newscrollboxh = scrollbox.offsetHeight;
+ if (scrollboxh != newscrollboxh) {
+ scrollchange = 1;
+ }
+ }
+ if (ismobile && scrollchange) {
+ \$("#div_$names{'scroll'}").getNiceScroll().onResize();
}
return;
}
More information about the LON-CAPA-cvs
mailing list