Perhaps you were reading yesterdayโs Maths Ouija Board Quiz Primer Tutorial and wondering โwhat gives with the โmo_me_rt_t.htmโ name of the web applicationโ? Well, the original inspiration at โMoving the mouse: mouseover/out, mouseenter/leaveโ, thanks, was for an Onmouseover and Onmouseout Event Monitor web application, and today we go back and add to โฆ
- Maths Ouija Board Quiz โฆ based on table cells โฆ to โฆ
- Onmouseover and Onmouseout Event Monitoring โฆ based on div elements โฆ
โฆ because nested hierarchical element arrangements like with HTML tables (with their cells) muddy the waters quite a bit trying to show the user a log also involving โฆ
These events are special, because they have property relatedTarget. This property complements target. When a mouse leaves one element for another, one of them becomes target, and the other one โ relatedTarget.
For mouseover:
event.target โ is the element where the mouse came over.
event.relatedTarget โ is the element from which the mouse came (relatedTarget โ target).
For mouseout the reverse:
event.target โ is the element that the mouse left.
event.relatedTarget โ is the new under-the-pointer element, that mouse left for (target โ relatedTarget).
โฆ and we want to mull over this, starting by logging event behaviour. We allow for an HTML h1 click/touch toggling of functionality, and we initially have the table cells show, but a toggling, maps over these table cells, position and all, with โฆ
- HTML divs โฆ
- CSS styled like table cells (ie. td) โฆ and using โฆ
- HTML table cell (ie. td) outerHTML property โฆ added with โฆ
- โoverlayโ favourites โฆ
- position:absolute property
- [HTML element].getBoundingClientRect() method to arrive with properties top, left, width, height (as we did with HTML map area subelements mapped to div when we presented Very Versus Too Game Primer Tutorial)
โฆ and โunderlayโ [HTML element].style.display=โnoneโ or [HTML element].style.visibility=โhiddenโ
See thechanged mo_me_rt_thtm dual
purpose live run link.
Previous relevant Maths Ouija Board Quiz Primer Tutorial is shown below.
Weโre not really using a ouija board with todayโs Maths Quiz web application, but if you use the mouse or trackpad means by which to answer the Maths arithmetic, it can feel like an ouija board in play.
Weโve arranged answers that just involve numbers so can have it that โฆ
- keyboard numbers can be interpreted as part of a userโs answer โฆ
- keyboard non-numbers can be interpreted as go check the answer โฆ
- onmouseover or onclick of number buttons are interpreted as part of a userโs answer โฆ
- onmouseover or onclick of โCheck Answerโ buttons go check the answer
The third of those above you may wonder about double ups. We left a setTimeout period of no doubling up between onmouseover and onclick event logics to help here.
Todayโs quiz scoring allows for bonus points for those quick to answer. The countdown of bonus points, as above, is achieved via a setTimeout timer.
Do you want to give todayโs HTML/Javascript/CSS mo_me_rt_thtm a go? We hope you do!
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.