All Projects → Alhadis → Accordion

Alhadis / Accordion

Licence: ISC license
Silky-smooth accordion widgets with no external dependencies.

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to Accordion

react-native-panel
A Customizable React Native Panel for Android and iOS
Stars: ✭ 35 (+9.38%)
Mutual labels:  accordion, dropdown, menu
Bootstrap Dropdown Hover
Bootstrap based responsive mulltilevel dropdown navigation menu with fascinating animations
Stars: ✭ 115 (+259.38%)
Mutual labels:  navigation, dropdown, menu
Dropdownmenukit
UIKit drop down menu, simple yet flexible and written in Swift
Stars: ✭ 246 (+668.75%)
Mutual labels:  navigation, dropdown, menu
Jquery Ui Contextmenu
jQuery plugin that turns a jQueryUI menu widget into a context menu.
Stars: ✭ 170 (+431.25%)
Mutual labels:  widget, menu
Bubble Navigation
🎉 [Android Library] A light-weight library to easily make beautiful Navigation Bar with ton of 🎨 customization option.
Stars: ✭ 1,537 (+4703.13%)
Mutual labels:  widget, navigation
Nativescript Drop Down
A NativeScript DropDown widget.
Stars: ✭ 107 (+234.38%)
Mutual labels:  widget, dropdown
Flutter radial menu
A simple animated radial menu widget for Flutter.
Stars: ✭ 359 (+1021.88%)
Mutual labels:  widget, menu
wui
Collection of GUI widgets for the web
Stars: ✭ 44 (+37.5%)
Mutual labels:  widget, dropdown
Flutter smart select
SmartSelect allows you to easily convert your usual form select or dropdown into dynamic page, popup dialog, or sliding bottom sheet with various choices input such as radio, checkbox, switch, chips, or even custom input. Supports single and multiple choice.
Stars: ✭ 179 (+459.38%)
Mutual labels:  widget, dropdown
clicky-menus
Simple click-triggered navigation submenus. Accessible and progressively enhanced.
Stars: ✭ 76 (+137.5%)
Mutual labels:  dropdown, menu
UT Framework
Various advanced tools built for Unreal Engine 4
Stars: ✭ 45 (+40.63%)
Mutual labels:  widget, navigation
Material Bottomnavigation
Bottom Navigation widget component inspired by the Google Material Design Guidelines at https://www.google.com/design/spec/components/bottom-navigation.html
Stars: ✭ 1,375 (+4196.88%)
Mutual labels:  widget, navigation
Fancyaccordionview
An Android fancy accordion view
Stars: ✭ 64 (+100%)
Mutual labels:  widget, accordion
Hibiscus.js
Native Angular directives for Bootstrap4
Stars: ✭ 115 (+259.38%)
Mutual labels:  widget, accordion
Chip Navigation Bar
An android navigation bar widget
Stars: ✭ 491 (+1434.38%)
Mutual labels:  widget, navigation
Autocomplete
Blazing fast and lightweight autocomplete widget without dependencies. Only 1KB gzipped. Demo:
Stars: ✭ 244 (+662.5%)
Mutual labels:  widget, dropdown
vue-bottom-navigation
Vue bottom navigation
Stars: ✭ 56 (+75%)
Mutual labels:  navigation, menu
SidebarOverlay
Yet another implementation of sidebar menu, but here your menu appears over the top view controller.
Stars: ✭ 66 (+106.25%)
Mutual labels:  navigation, menu
a11yAccordion
An accessible and easy to use Accordeon widget.
Stars: ✭ 37 (+15.63%)
Mutual labels:  widget, accordion
Side Menu.ios
Animated side menu with customizable UI
Stars: ✭ 2,702 (+8343.75%)
Mutual labels:  navigation, menu

Accordion

Silky-smooth accordion widgets with no external dependencies.

npm install accordion --save
bower install silk-accordion --save

An simple interactive demo can be found here. More complicated and extreme demos can be found in the demos directory.

Usage

Include the following two files in your project:

src/accordion.css
src/accordion.js

Layout your markup like this:

<div class="accordion">

	<div>
		<h1> Heading </h1>
		<div> Content </div>
	</div>
	
	<div>
		<h1> Heading </h1>
		<div> Content </div>
	</div>
	
</div>

Then create an Accordion instance with a reference to a DOM element:

var el = document.querySelector(".accordion");
new Accordion(el);

Options can be passed in a second argument:

new Accordion(el, {
	onToggle: function(fold, isOpen){
		console.log(fold);   // -> Reference to a `Fold` instance
		console.log(isOpen); // -> true / false
	}
});

Styling

The base stylesheet is located at src/accordion.css. Embed it into your application's existing styling, tweaking it if desired.

Note: This stylesheet only includes properties necessary for the Accordion to function. Making it look appealing with colours and fonts is left as an exercise to the developer. Check the source of the bundled demos for some ideas.

Using ES6 modules

If your project uses native JavaScript modules, consider loading src/accordion.mjs instead:

<!-- ES6+ -->
<script type="module">
	import Accordion from "./src/accordion.mjs";
	for(const el of document.querySelectorAll(".accordion"))
		new Accordion(el);
</script>

The old accordion.js file contains only ES5, and can be used as a fallback for older platforms which lack ES module support:

<!-- Fallback to ES5 for legacy browsers -->
<script nomodule src="src/accordion.js"></script>
<script nomodule>
	"use strict";
	var accordions = document.querySelectorAll(".accordion");
	for(var i = 0, l = accordions.length; i < l; ++i)
		new Accordion(accordions[i]);
</script>

IE8 support

For IE8-9 compatibility, install fix-ie:

npm install fix-ie --save
bower install fix-ie --save

Then link to it using a conditional comment, before any other script on the page!

<!DOCTYPE html>
<html lang="en">
	<head>
	<!--[if lte IE 9]>
		<script src="node_modules/fix-ie/dist/ie.lteIE9.js"></script>
	<![endif]-->
	<meta charset="utf-8" />

This fixes IE's buggy handling of Object.defineProperty, which the Accordion makes extensive use of. fix-ie also provides oodles of helpful polyfills to fix IE8's shoddy DOM support.

Options

Name Type Default Description
closeClass String "closed" CSS class used to mark a fold as closed
disabled Boolean false Whether to disable the accordion on creation
disabledClass String undefined CSS class marking an accordion as disabled
edgeClass String "edge-visible" CSS class toggled based on whether the bottom-edge is visible
enabledClass String "accordion" CSS class marking an accordion as enabled
heightOffset Number 0 Distance to offset each fold by
modal Boolean false Whether to close the current fold when opening another
noAria Boolean false Disable the addition and management of ARIA attributes
noKeys Boolean false Disable keyboard navigation
noTransforms Boolean false Disable CSS transforms; positioning will be used instead
onToggle Function undefined Callback executed when opening or closing a fold
openClass String "open" CSS class controlling each fold's "open" state
snapClass String "snap" CSS class for disabling transitions between window resizes
useBorders Boolean "auto" Consider borders when calculating fold heights
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].