html - how to make an icon a drop down list when clicked? -



html - how to make an icon a drop down list when clicked? -

i have canvas in have 2 icons aligned right. want when 1 of icon clicked, drop downwards menu should open containing options.

but don't know how create drop downwards list when icon clicked.so need help on this.

as cannot set html elements within <canvas>, have position html elements appear within canvas. main trick wrap <canvas> element within wrapper <div> so

edit added image drop-down also, heavily inspired form bootstrap drop-downs. although it's basic, should work. if want total featured, take above link ( , whole bootstrap fromework pretty good).

class="snippet-code-js lang-js prettyprint-override">$(".dropdown>[data-toggle='dropdown']").on('click', function(){ $(this).parent(".dropdown").toggleclass("open"); }); class="snippet-code-css lang-css prettyprint-override">#ex-canvas-wrapper{ postion: relative; } #ex-canvas { border: 2px solid #16a085; background-color: #ecf0f01; } #canvas-select { position:absolute; left: 138px; top: 12px; } #canvas-dropdown{ position: absolute; left: 145px; top: 35px; } .dropdown>.dropdown-menu{ display: none; position: absolute; border: 1px solid #bdc3c7; min-width: 60px; margin: 0; } .dropdown.open>.dropdown-menu{ display: inline-block; } class="snippet-code-html lang-html prettyprint-override"><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div id="ex-canvas-wrapper"> <canvas id="ex-canvas" width="200" height="100"></canvas> <select id="canvas-select"> <option value="value1">value 1</option> <option value="value2" selected>value 2</option> <option value="value3">value 3</option> </select> <div class="dropdown" id="canvas-dropdown"> <img data-toggle="dropdown" src="http://i59.tinypic.com/2cgdh87.png"> <ul class="dropdown-menu"> <li>value 1</li> <li>value 2</li> <li>value 3</li> </ul> </div> </div>

html css

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -