requirejs - UI that depends on slow loading javascript -
all of scripts page being concatenating / optimized (requirejs) single file. stands, script takes while load depending upon browser , network connection ~ 0.5 mb.
on 1 of main landing pages users funneled to, have interaction (e.g. button, lets call "click me button") dependent upon script - event handlers etc. in other words, button nothing until script has been downloaded , loaded: e.g. empty href
.
currently, if testing on old browser or slow connection, user see or of dom including "click me button" before script has finished loading. result, there delay (sometimes few seconds) clicking on button nothing @ all.
i wondering:
- is there perhaps way architect such can remove delay between time button shown when clickable (via js interaction). remember scripts page concatenated single file. can try , trim down size of file, still feels wrong because there theoretically possible lag.
- is there else in description stands out undesirded architecture. such perhaps giving button default, non js-dependent, behavior if user click happens - feels bit strange since there 2 different behaviors depending on how fast user happens click button.
one potential solution might use separate js function hide button in question until dependent larger js file has loaded. use on.load('your js file) command in conjunction hidden css class on particular button div.
onload=function() { document.getelementbyid('button').classname='visible'; }
you might consider separating js function in question out , loading when dom ready. document.ready particular functionality guaranteed available while other ui , js functionality still being loaded in background.
not sure description if either of these feasible in particular case consider. also, have minified webpage/css/js code in question loading times? file size seems large, including public libraries don't need to?
Comments
Post a Comment