A trigger for a SweetDropdown can be really .
<div class="dropdown-menu dropdown-anchor-top-left dropdown-has-anchor" id="dropdown-standard"> <ul> <li><a href="#">Item 1</a>></li> <li><a href="#">Item 2</a></li> <li class="divider"></li> <li><a href="#">Item 3</a></li> </ul> </div>
<button data-dropdown="#dropdown-standard">Try out!</button>
<div class="dropdown-menu dropdown-anchor-top-left dropdown-has-anchor" id="dropdown-with-icons"> <ul> <li><a href="#"><svg>...</svg> Item 1</a>></li> <li><a href="#"><svg>...</svg> Item 2</a></li> <li class="divider"></li> <li><a href="#"><svg>...</svg> Item 3</a></li> </ul> </div>
<button data-dropdown="#dropdown-with-icons">Try out!</button>
<div class="dropdown-menu dropdown-anchor-top-left dropdown-has-anchor dark" id="dropdown-dark-with-icons"> <ul> <li><a href="#"><svg>...</svg> Item 1</a>></li> <li><a href="#"><svg>...</svg> Item 2</a></li> <li class="divider"></li> <li><a href="#"><svg>...</svg> Item 3</a></li> </ul> </div>
<button data-dropdown="#dropdown-dark-with-icons">Try out!</button>
<div class="dropdown-menu dropdown-anchor-left-center dropdown-has-anchor" id="dropdown-standard"> <ul> <li><a href="#">Item 1</a>></li> <li><a href="#">Item 2</a></li> <li class="divider"></li> <li><a href="#">Item 3</a></li> </ul> </div>
<button data-dropdown="#dropdown-left-center">Try out!</button>
<div class="dropdown-menu dropdown-anchor-top-left" id="dropdown-no-anchor-html"> <p>I am <b>HTML</b>-<i>Content</i>.</p> <button>And a button!</button> </div>
<button data-dropdown="#dropdown-no-anchor-html">Try out!</button>
Note:
For dropdowns without anchor you still specify where the anchor would be normally but leave out
dropdown-has-anchor
.
$ bower install sweet-dropdown
$ npm install sweet-dropdown
<link rel="stylesheet" href="sweet-dropdown/dist/min/jquery.sweet-dropdown.min.css" />
<script src="sweet-dropdown/dist/min/jquery.sweet-dropdown.min.js"></script>
/*! * SweetDropdown: Sweet and versatile dropdowns * v<%= pkg.version %>, <%= grunt.template.today("yyyy-mm-dd") %> * http://github.com/adeptoas/sweet-dropdown * * Copyright (c) 2016 Adepto.as AS · Oslo, Norway * Dual licensed under the MIT and GPL licenses. * * See LICENSE-MIT.txt and LICENSE-GPL.txt */