javascript - Div with background, image not clickable -


trying make div both background image , color clickable, reason image not clickable, background color.

css

.arrow2 {     display:inline-block;         background: url('toggle2.png') no-repeat center;         width: 30px;         height: 100%; }   #toggle2 {     display: none;     background: rgba(40, 40, 40, 0.7);     position: absolute;     top:10px;     width: 30px;     height: 50px;     background-color: rgba(40, 40, 40, 0.7);     cursor: pointer;     border-radius: 0px 10px 10px 0px;     justify-content:center;     align-content:center;     flex-direction:column; /* column | row */ } 

html

<div id="toggle2"><span class="arrow2"></span></div> 

javascript (jquery)

$('.arrow2').click(function() { $('#navigation').toggle('slow'); $('#toggle').toggle('show'); $('#toggle2').toggle('hide'); }); 

i have tried both using .arrow , #toggle2 onclick trigger, same result.

cannot comment due reputation score.

how can click .arrow2 if it's parent set display: none? in case cannot click neither .arrow2 nor #toggle2, cannot see them on page load.

may wanted #toggle firstly hidden, not #toggle2. works https://codepen.io/evomedia/pen/wezryz


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -