--- rat/lonwrapper.pm 2019/08/02 00:19:00 1.49.2.7 +++ rat/lonwrapper.pm 2020/02/16 23:52:03 1.49.2.8 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Wrapper for external and binary files as standalone resources # -# $Id: lonwrapper.pm,v 1.49.2.7 2019/08/02 00:19:00 raeburn Exp $ +# $Id: lonwrapper.pm,v 1.49.2.8 2020/02/16 23:52:03 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -85,7 +85,25 @@ sub wrapper { $args->{'only_body'} = $env{'form.only_body'}; } - my $startpage = &Apache::loncommon::start_page('Menu',undef,$args); + my $headjs; + +# +# Where iframe is in use, if window.onload() executes before the custom resize function +# has been defined (jQuery), two global javascript vars (LCnotready and LCresizedef) +# are used to ensure document.ready() triggers a call to resize, so the iframe contents +# do not obscure the Functions menu. +# + + unless (($env{'browser.mobile'}) || $uselink) { + $headjs = ' +'."\n"; + + my $startpage = &Apache::loncommon::start_page('Menu',$headjs,$args); my $endpage = &Apache::loncommon::end_page(); if (($uselink) && ($title eq '')) { @@ -149,8 +167,20 @@ sub wrapper { var pos = height + hdrtop + offset; \$('.LC_iframecontainer').css('top', pos); }); + LCresizedef = 1; + if (LCnotready == 1) { + LCnotready = 0; + \$(window).trigger('resize'); + } }); - window.onload = function(){ \$(window).trigger('resize') }; + window.onload = function(){ + if (LCresizedef) { + LCnotready = 0; + \$(window).trigger('resize') }; + } else { + LCnotready = 1; + } + }; SCRIPT # javascript will position the iframe if window was resized (or zoomed) return <