lo-th / 3d.city

3d city builder game
http://lo-th.github.io/3d.city/index.html
Other
1.56k stars 316 forks source link

Display pop-up when you hoer over a button for more details #38

Open ghost opened 7 years ago

ghost commented 7 years ago

you add a pop up when you hover over a button, for instance when you hover over you money it wll display 'your money' , and when you hover over the times of the days, it will display 'day', 'dawn' 'dusk', or, 'night'.

<div id="parent">
This is the main container.
<div id="popup" style="display: none">some text here</div>
</div>
var e = document.getElementById('parent');
e.onmouseover = function() {
  document.getElementById('popup').style.display = 'block';
}
e.onmouseout = function() {
  document.getElementById('popup').style.display = 'none';
}

or just using CSS you could get rid of the javascipt.

#parent #popup {
  display: none;
}

#parent:hover #popup {
  display: block;
}

you could also use the 'title attribute.

I'm not sure if the info above will help as you don't seem to be using HTML, only using javascript a lot and linking it to the <canvas> tag

Ragerds, Taiwei

ghost commented 7 years ago

Also just a question, what is the trophy icon in the lower left next to your money for? Please answer when you see this (or ASAP).

Thanks.