html - Displaying new rows of buttons and images on button clicks -
i apologize in advance-- i'm very, new this.
i want have 2 rows of buttons change 1 set of images displays on page. ideally, when button on top row clicked, 3 or 4 images displayed, , buttons on second row appear. buttons on second row, when clicked, replace images clicking on first row displayed, , leave second row displaying.
the idea display various guitar chord positions, if first button on top row clicked, a, 3 or 4 positions major chords displayed, , images replaced clicking buttons on second row; buttons minor, seventh, etc, , display few positions well.
i've vastly oversimplified i'm trying do, jsfiddle: https://jsfiddle.net/tktyytmt/
<script> function myfunction() { var x = document.getelementbyid('mydiv'); if (x.style.display === 'block') { x.style.display = 'none'; } else { x.style.display = 'block'; } } </script> <script> function myotherfunction() { var x = document.getelementbyid('myotherdiv'); if (x.style.display === 'block') { x.style.display = 'none'; } else { x.style.display = 'block'; } } </script> <div> <ul style="list-style-type:none" id="navlist"> <li class="titles">letter:</li> <br> <li> <button onclick="myfunction()" class='button'>a</button> <div id="mydiv"> <img src="https://i.pinimg.com/564x/77/97/2d/77972d9d8364c1c94aa6520af5836548.jpg" class='chordimg'> <img src="http://i.stack.imgur.com/sqcay.png" class='chordimg'> </div> </li> </ul> <div> <ul style="list-style-type:none" id="navlist"> <li class="titles">color</li> <br> <li> <button onclick="myotherfunction()" class='button'>blue</button> <div id="myotherdiv"> <img src="http://www.drodd.com/images15/letter-a25.jpg" class='chordimg'> <img src="https://etc.usf.edu/presentations/extras/letters/varsity_letters/39/13/a-400.png" class='chordimg'> <img src="http://www.polyvore.com/cgi/img-thing?.out=jpg&size=l&tid=42246936" class='chordimg'> </div> </li> #mydiv { display: none; position: absolute; top: 125px; left: 40px; } #myotherdiv { display: none; position: absolute; } #navlist li { display: inline; list-style-type: none; padding-right: 20px; }
Comments
Post a Comment