Tanuel / TmDropdown

Lightweight Javascript Library for costum select dropdowns. Also provides jQuery integration.

Home Page:https://tanuel.github.io/TmDropdown

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This Project is currently not maintained and severly out of Date!

TmDropdown

Leightweight JavaScript Library/Plugin for costum select dropdowns. Also provides optional jQuery integration.

Read the full documentation here!

The latest release is located here.

Install via package manager

npm:
npm install tmdropdown

bower bower install tmdropdown

Basic Usage

Complete reference here.

Include CSS and JS on your website:

<link rel="stylesheet" href="css/TmDropdown.css">
<!--optional: include jQuery before TmDropdown.js to make use of the jQuery-Plugin-->
<script src="js/TmDropdown.js"></script>

Create a HTML-Select

<select class="tmDropdown">
    <option>option 1</option>
    <option>option 2</option>
    <option disabled>option 3 (disabled)</option>
</select>

Init TmDropdown:

//Native Javascript:
document.addEventListener("DOMContentLoaded", function () {
    //--- Initialization---
    //Get Elements
    document.querySelectorAll(".tmDropdownNative")
        .forEach(function (element) {
            //init the plugin
            new TmDropdown(element);
        });
});

//jQuery
$(document).ready(function () {
    //init the plugin
    $("select.tmDropdown").tmDropdown();
});

This Plugin also supports Optgroups like this:

<select class="tmDropdown">
    <option>Option ohne Gruppe</option>
    <optgroup label="Gruppe 1">
        <option>Option 1</option>
        <option>Option 2</option>
    </optgroup>
    <optgroup label="Gruppe 2">
        <option>Option 3</option>
        <option>Option 4</option>
    </optgroup>
</select>

About

Lightweight Javascript Library for costum select dropdowns. Also provides jQuery integration.

https://tanuel.github.io/TmDropdown

License:GNU General Public License v3.0


Languages

Language:JavaScript 66.7%Language:HTML 29.1%Language:CSS 4.2%