MaxelRus MaxelRus - 2 months ago 17
Javascript Question

How to make the whole div clickable

I'm making a menu and have one simple and stupid issue. The problem is: I have my

<span>
elements inside a 'Menu'
div
. With id
'#menu'
. I've made a feature by which you can't accidentally click on the
<a>
inside the
<span>
through CSS
visibility
. But now if you click the menu in space between white stripes, it won't act like a button.

So the question is: 'How to make this
<div>
fully clickable?'


Here's the Fiddle.

Thanks in advance.

Answer

simply do this add a width to menu div

#menu {
    -moz-user-select: none;
    height: 40px;
    margin: 50px;
    position: absolute;
    width: 40px; /* newly added */
}