--- layout: default title: "Drop / Select / Tether" --- Drop / Select / Tether ====== [Drop](https://github.com/HubSpot/drop) is a Javascript and CSS library for creating dropdowns and other popups attached to elements on the page. [Select.js](https://github.com/HubSpot/select) is a Javascript and CSS library for creating styleable select elements. Both use [Tether.js](https://github.com/HubSpot/tether) to efficiently position elements. ## 1: Basic Example with Drop

~~~js drop1 = new Drop({ target: document.querySelector('.drop-example-1'), content: 'Welcome to the whatever', position: 'bottom center', classes: 'drop-theme-arrows-bounce-dark', openOn: 'click' }); ~~~ ## 2: Dropdown-like Example with Drop

~~~js drop2 = new Drop({ target: $('.drop-example-2')[0], content: $('.drop-content-example').html(), position: 'bottom center', classes: 'drop-theme-arrows-bounce', openOn: 'hover' }); ~~~ ## 3: Basic Select Example

~~~js var select_example = new Select({el: $('#select-example')[0]}); select_example.on('change', function(e){ alert('You picked: '+e.value);}) ~~~ ## 4: Containing Contain the drop element to a parent
~~~html
~~~ ~~~css .some-container { border: 1px solid black; width: 400px; height: 250px; overflow: auto; position: relative; } ~~~ ~~~js $(function () { var drop4; drop4 = new Drop({ target: document.querySelector('.drop-example-4'), content: 'Welcome to the whatever
yadda yadda yadda yadda yadda yadda yadda yadda yadda
', position: 'bottom center', classes: 'drop-theme-arrows-bounce', openOn: 'click', tetherOptions: { constraints: [ { to: 'scrollParent', pin: true } ] } }); }); ~~~