Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drop down option menu using onsen UI

I want to develop drop down menu header as available in android navigation toolbar. I am using phonegap & onsen UI Framework to develop mobile application. I can able to load sliding menu from left & right side but right now my requirement is to open drop down if one should press icon display in image.

Same list should be displayed(open) if user press option button from phone device. I am not using jquery or jquery mobile to develop mobile UI. I don't want to develop drop down menu using html5 & css, so I request you please let me know some alternative way to handle it.

like image 421
jalpa Avatar asked Nov 25 '14 09:11

jalpa


1 Answers

You could try using <ons-popover> with an <ons-list> inside.

Create the popover inside a template:

<ons-template id="popover.html>
  <ons-popover direction="down" cancelable>
    <ons-list>
      <ons-list-item modifier="tappable">Option 1</ons-list-item>
      ...
    </ons-list>
  </ons-popover>
</ons-template>

You can show the popover using the following JavaScript code:

ons.createPopover('popover.html').then(function(popover) {
  popover.show();
});

I've created an example that shows how you can use it as a dropdown menu: http://codepen.io/argelius/pen/zxGEza

like image 177
Andreas Argelius Avatar answered Sep 30 '22 18:09

Andreas Argelius