Occasionally resizing, and we include in here โpinchingโ and โstretchingโ mobile platform gestures, presents situations you donโt feel like you can โlet go through to the keeperโ coding and testing web applications on a web browser.
Our recent Emoji Menu work, with its โonclick scenarioโ inhouse webpages, as talked about with WordPress Emoji Menu Revamp Tutorial, is a case in point for us. It used to be that zooming in left unused webpage โreal estateโ to the right and bottom, and we thought we could improve on that.
What gets you to an intervention point with web browser screen resizing? There may be some window object method, but we usually apply an โฆ
- onresize โฆ event call, and event code โฆ to โฆ
- document.body โฆ along with some onload event timed interventions, to help, as well โฆ
<head>
<script type=text/javascript>
var sw=0;
var sh=0;
var rectis=null;
var ifb='ifblank';
function donow() {
document.getElementById('myHeader').innerHTML=sbitis;
sw=eval('' + screen.width);
sh=eval('' + screen.height);
rectis=document.getElementById('ifblank').getBoundingClientRect();
}
function resz() {
//alert('sw=' + sw + ' and now window.innerWidth=' + window.innerWidth);
document.getElementById('ifblank').style.width='' + eval(eval('' + rectis.width) * eval(sw / window.innerWidth)) + 'px';
document.getElementById('ifblank').style.height='' + eval(eval('' + rectis.height) * eval(sh / window.innerHeight)) + 'px';
}
</script>
</head>
<body style=width:100%;height:100%; onresize=resz(); onload=donow(); title="Double click in blank option toggles between displaying web application to right (as now) or in new window." ondblclick=fliptog();>
โฆ where, as you can surmise, we actually did some work to understand the behaviour of window.innerWidth and window.innerHeight and we were gobsmacked when they got smaller when the webpage became bigger (ie. zooming in). In the meantime, on this MacBook Airโs web browser screen.width and screen.height remained unchanged during our tests, and so it tweaked with us that using them all together can determine dpi (dots per inch) resolution aspects, and that we could better use the resized screen better via those โฆ
document.getElementById('ifblank').style.width='' + eval(eval('' + rectis.width) * eval(sw / window.innerWidth)) + 'px';
document.getElementById('ifblank').style.height='' + eval(eval('' + rectis.height) * eval(sh / window.innerHeight)) + 'px';
โฆ recalculations of the hosted HTML iframe element dimensions weโre now using to the right of the dropdown Emoji Menu in thechanged emoji_widget_ideahtm standalone Emoji Menu web application.
Previous relevant WordPress Emoji Menu Revamp Tutorial is shown below.
We really like HTML iframe usage around here. In terms of โฆ
Software Need Not Be Hard
โฆ being our company byline, they tick a lot of boxes. Youโll read online, though, issues with security and whatnot regarding them, so, as with all these matters, it is better to read around. However, if you intend building up lots of web applications in your domain, online, HTML iframe elements โฆ
- allow for chance to modularize โฆ
- without it, necessarily, looking clunky โฆ as well as โฆ
- is a means to introduce onload event logic not tied to document.body onload event โฆ like a chance to โresetโ โฆ as well as โฆ
- can be a means, what we like to call โClient Pre-emptive Iframeโ thinking, to test for the existence of a URL โฆ as well as โฆ
- the HTML iframe name attribute can tee up with second argument of Javascript window.open to think of โthe dreaded popup window actually being the more acceptable iframe window (relatively speaking)โ โฆ as well as โฆ
- the HTML iframe src attribute is a good Javascript DOM access point to use an iframe when you know the URL โฆ versus โฆ
- the HTML iframe srcdoc attribute is a good Javascript DOM access point to use an iframe when you know the content
Hence, iframe usage got front and centre when thinking on how to revamp the Emoji Menu arrangements, at this blog, talked about at WordPress Emoji Menu Primer Tutorial. That old arrangement opened new (second _blank arguments to window.open) to new windows, only, and felt a bit over the top, to us, especially because these Emoji Menus predominantly showcased Inhouse Web Applications. Why not, at least, involve HTML iframe elements into the mix?
That got us adjusting a WordPress โEmoji Menuโ Page for โclicking the Emoji Menu, here at this blog (or in new window), purposesโ scenario and then there was thechanged emoji_widget_ideahtm standalone Emoji Menu web application we wrote for the โhovering over the Emoji Menu, here at this blog, purposesโ scenario.
We think the filling in of webpage space to the right of the Emoji Menu dropdown element is more elegant. What do you think?
Previous relevant WordPress Emoji Menu Primer Tutorial is shown below.
The Emoji Menu concept mentioned in the previous Fixed Sticky Header Top Window Document Tutorial has been the inspiration to โฆ
- add a new WordPress primary menu level โEmoji Menuโ option (via the WordPress administration sectionโs Add Page option) โฆ that โฆ
- onclick calls a (WordPress) Page that is a select (dropdown) element size=9 (for non-mobile browser usefulness) whose innerHTML (ie. what you see) consists of emojis โฆ and on a selection โฆ
- opens into a new webpage a web application from the RJM Programming domain โฆ similarly for the โฆ
- onmouseover (hover (Ajax feeling functionality), for non-mobile browser usefulness) immediate display of a (smaller) select (dropdown) element directly below the โEmoji Menuโ option heading โฆ facilitated by a changed header.php coding change โฆ
<script type="text/javascript">
function donow() {
var sbitis='<select size=9 id="emojih" onchange=window.open(this.value,"_blank");><option title="Web Audio" style="cursor:pointer;text-decoration:none;font-size:36px;" target="iweb_audio" id="aweb_audio" value="//www.rjmprogramming.com.au/HTMLCSS/web_audio.htm">🔊</option><option title="Square Hr Tracing" style="cursor:pointer;text-decoration:none;font-size:36px;" target="isquare_hr_tracing" id="asquare_hr_tracing" value="//www.rjmprogramming.com.au/HTMLCSS/square_hr_tracing.htm">📏</option><option title="Emoji Walk Animation" style="cursor:pointer;text-decoration:none;font-size:36px;" target="iemoji_walk_animation" id="aemoji_walk_animation" value="//www.rjmprogramming.com.au/HTMLCSS/emoji_walk_animation.htm">🏃🏾‍♀️</option><option title="Fruits" style="cursor:pointer;text-decoration:none;font-size:36px;" target="ifruits" id="afruits" value="//www.rjmprogramming.com.au/HTMLCSS/fruits.html">🍌</option><option title="Name Your Mascot" style="cursor:pointer;text-decoration:none;font-size:36px;" target="iname_your_mascot" id="aname_your_mascot" value="//www.rjmprogramming.com.au/HTMLCSS/name_your.html">📧</option><option title="Sushi Train" style="cursor:pointer;text-decoration:none;font-size:36px;" target="isushi_train" id="asushi_train" value="//www.rjmprogramming.com.au/HTMLCSS/circuit.htm">🍱</option><option title="Flag Quiz" style="cursor:pointer;text-decoration:none;font-size:36px;" target="iflag_quiz" id="aflag_quiz" value="//www.rjmprogramming.com.au/HTMLCSS/flagquiz.htm">🇦🇩</option><option title="Emoji Overlay" style="cursor:pointer;text-decoration:none;font-size:36px;" target="iemoji_overlay" id="aemoji_overlay" value="//www.rjmprogramming.com.au/HTMLCSS/emoji_overlay.htm">🔝</option><option value="" selected></option></select>';
sbitis='<iframe src="//www.rjmprogramming.com.au/HTMLCSS/emoji_widget_idea.htm"></iframe>';
var isdone=0, is2done=0;
if (document.getElementsByClassName){
var x304x = document.getElementsByClassName('page-item-304');
x304x[0].onmouseover = function() { var xl=document.getElementById('x2language'); xl.style.display = 'block'; };
isdone = 1;
var x46544x = document.getElementsByClassName('page-item-46575');
x46544x[0].onmouseover = function() { if (this.innerHTML.replace('iframe ','select ').indexOf('select ') == -1) { this.innerHTML+=sbitis; } };
is2done = 1;
} else { // IE
//var qis = document.getElementById("pick_content").contentWindow.document;
var ilis = 0;
var eleis, ele2is;
var lisis = document.getElementsByTagName("li");
while (eleis = lisis[ilis++]) {
if (eleis.className == "page-item-304" && isdone == 0) {
eleis.onmouseover = function() { var xl=document.getElementById('x2language'); xl.style.display = 'block'; };
isdone = 1;
}
if (eleis.className.indexOf("page-item-46575") != -1 && is2done == 0) {
eleis.onmouseover = function() { var xl2=document.getElementById('emojih'); xl2.style.display = 'block'; };
is2done = 1;
}
}
}
}
setTimeout(donow,2000);
</script>
โฆ that HTML iframe emoji_widget_ideahtm content (live
run) preference above arising from our desire to add more flexibility to this content down the track.
Previous relevant Fixed Sticky Header Top Window Document Tutorial is shown below.
The recent Fixed Sticky Header Primer Tutorial involved โฆ
- a supervisory โemoji menuโ web application hosting โฆ
- supervised iframe element hosted web applications
โฆ and you may think, if all this is going on with web applications on the same domain, whatโs the big deal? What could go wrong? (These words always bringing a knowing chuckle around here!)
For the most part, itโs true, there were no issues, but one โsupervised iframe element hosted web applicationโ we tried did not behave with all its functionality happening. Lo and behold, applying a web inspector showed up an error, with a codeline (in Javascript) that went โฆ
mcp=parent.document.getElementById('lcp').value;
โฆ and then we summed this up in two different strands of thought โฆ
- can we write a generic external piece of Javascript called just before </body> that can pluck out lines of code, with corresponding line codes, and see if โparent.documentโ or โtop.documentโ occur in them and effectively โbetter debugโ within an errorHandler function that further examines this โnullโ return error โฆ which looking into is not as easy as first optimistically envisaged โฆ versus โฆ
- get in there specifically with the web inspector, adjust the code of the โsupervised iframe element hosted web applicationโ and have it work being โฆ
- additionally supervised this way โฆ and more importantly โฆ
- still work the way it used to unsupervised, as ever it has worked up to now
โฆ via the simple (age old) paradigm, involving debugging (web applications, at the client level) via tools like (the web browser) Safariโs Web Inspector โฆ
- Using Web Inspector type tools:
Identify the issue via โฆ
Error line
Error line number - Using Web Inspector type tools:
Fix the issue until no errors happen
And what would have been the better generic coding for a web application that may become a โsupervised web applicationโ (in different ways) into the future.
Donโt just โฆ |
---|
|
But do โฆ |
|
โฆ in other words, check window object existence, before you assume document object existence, with thechanged emoji_slideshowhtm part within the emoji
menu supervisor live run linkโschanged fixed_top
html code.
Previous relevant Fixed Sticky Header Primer Tutorial is shown below.
Just like with the W3schools How To series inspired HTML and Javascript and CSS Survey Levelling Tutorial we have another W3schools inspired web application idea called โSticky Headerโ.
To quote W3schools regarding the design aspects to the fixed_tophtml โproof of conceptโ web application โฆ
On Scroll Sticky Header
The header will stick to the top when you reach its scroll position.
Scroll back up to remove the sticky effect.
Which takes us to what we wanted to try as an inhouse addition to functionality. We like emojis, as โtext meets button designโ. Hence, we also like the โtextโ emoji being like an โaโ link โbuttonโ, for two biggish reasons โฆ
- emoji buttons save space
- emoji buttons can look like images that can attract user attention, and be like an Internationizational improvement to your web application, given some careful consideration
โฆ that lead us to want to have the โSticky Headerโ contain an โemoji menuโ of โemoji buttonsโ, the โonclickโ events of which show content below the โSticky Headerโ in a one row table that pushes the latest content to the left of that row (so that our hashtagging logic will still see the emojis along with the latest selected content), yet allow an intrepid user venture right to โuncontrolled lands of functionalityโ should they wish. Weโre sticking left โฆ chortle, chortle.
Previous relevant HTML and Javascript and CSS Survey Levelling Tutorial is shown below.
With the โterrestrialโ side to Land Surveying (ie. that of the small distances kind), two โget out there and do itโ skills spring to mind, those being โฆ
- performing a traverse via the use of a theodolite (or โtotal stationโ) (as the web application works the mathematics of, off the field book, with the previous HTML and Javascript and CSS Survey Traverse Tutorial) working out the (โXโ,โYโ) of 2D โlifeโ โฆ and today, we add to that with โฆ
- performing a levelling run via the use of a level (or โtotal stationโ) โฆ
โฆ and with todayโs web application we simulate, to some degree, minus โhow to level a levelโ, looking through the โlevelโ viewer towards a โsurveying staffโ (held level and straight) on a point of something you want to know the elevation (or (3D โlifeโ) โZโ) of in terrestrial terms, relative to known elevations you will probably want to start pointing at (the โsurveying staffโ being on) with your first (often a known โdatumโ) โฆ
- Backsight โฆ then โฆ
- (however many Inter Sights followed by a) Foresight (and then back to Backsight, as necessary)
โฆ series of measurements (or โreadingโ) to derive โreduced levelsโ for each point the โsurveying staffโ visits. This, in most practice, involves alternately leapfrogging (each other, at different times) โฆ
- Land Surveyor recording and levelling the โlevelโ โฆ and a โฆ
- Chainperson levelling and straightening the โsurveying staffโ
โฆ the โsurveying staffโ we simulate in our web application (somewhat) thanks to Cody.
Thatโs the โwhatโ of the web application, but what about the โhowโ (let alone the who)? Here, we thank the great W3schools parallax ideas.
The โcentral CSS smartโ of these parallax ideas is the idea of โฆ
<style>
/* Create the parallax scrolling effect */
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: contain;
</style>
So take a look at parallax_examplehtmlโs live
run link to see what we mean.
Previous relevant HTML and Javascript and CSS Survey Traverse Tutorial is shown below.
Here is a tutorial showing some client-side basics in HTML and Javascript and CSS all in the one HTML file, to simplify concepts. The tutorial subject matter is a webpage to perform Survey Traverse calculations. A Survey Traverse is:
Traverse is a method in the field of surveying to establish control networks.[1] It is also used in geodesy. Traverse networks involve placing survey stations along a line or path of travel, and then using the previously surveyed points as a base for observing the next point. Traverse networks have many advantages, including:
Less reconnaissance and organization needed;
While in other systems, which may require the survey to be performed along a rigid polygon shape, the traverse can change to any shape and thus can accommodate a great deal of different terrains;
Only a few observations need to be taken at each station, whereas in other survey networks a great deal of angular and linear observations need to be made and considered;
Traverse networks are free of the strength of figure considerations that happen in triangular systems;
Scale error does not add up as the traverse is performed. Azimuth swing errors can also be reduced by increasing the distance between stations.The traverse is more accurate than triangulateration[2] (a combined function of the triangulation and trilateration practice).[3]
Letโs see some simple HTML in action in a tutorial โฆ
Link to HTML โspiritual homeโ โฆ at W3Schools has many tutorials.
Link to Survey Traverse live run โฆ here.
Link to Survey Traverse live run (additional Google Line Chart functionality) here.
Link to Survey Traverse information โฆ from Wikipedia from which quote above comes.
Link to some downloadable HTML code โฆ rename to SurveyTraversehtml which packages up a lot of Javascript and a little bit of CSS โฆ or JaCvasScriptS โฆ not sure whether this would ever catch on.
Link to some downloadable PHP programming code (additional Google Line Chart functionality) โฆ rename to SurveyTraversephp
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.