raoul2000/yii2-sidr-widget

The Sidr widget is a wrapper for the Sidr jQuery plugin, for creating side menus.

Installs: 3 424

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 4

Forks: 1

Open Issues: 0

Type:yii2-extension

1.0.0 2015-02-04 16:48 UTC

This package is not auto-updated.

Last update: 2024-10-30 08:41:48 UTC


README

The Sidr widget is a wrapper around the Sidr jQuery plugin, for creating side menus and "the easiest way for doing your menu responsive".

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist raoul2000/yii2-sidr-widget "*"

or add

"raoul2000/yii2-sidr-widget": "*"

to the require section of your composer.json file.

Usage

Using Sidr widget is easy. For example :

<?php
use raoul2000\widget\sidr\SidrAsset;
use raoul2000\widget\sidr\Sidr;

// The Sidr plugin comes with 2 built-in theme : 'dark' and 'light'
// In this example we will use the light theme

SidrAsset::$theme = SidrAsset::THEME_LIGHT;
?>

<!-- This button will open/close the side menu -->
<button id="open-menu">open/close Menu</button>

<!-- This is the menu header and content -->
<header id="demoheader">
	<h1>Demos &amp; Usage</h1>
</header>

<div id="demo-content">
	<p>
		Lorem ipsum dolor sit amet, consectetur adipisicing elit.
		 Quasi nihil ab possimus temporibus 
		illum ullam molestiae aliquam maiores .
	</p>
</div>

<!-- include the Sidr Widget -->
<?= Sidr::widget([
	'selector' => '#open-menu',
	'pluginOptions' => [
		'name' =>  'sidr-menu',
		'source' => '#demoheader, #demo-content',
		'onClose' => new yii\web\JsExpression('
			function() {
				alert("bye bye side menu !");
			}
		')
	]
]); ?>

For more information on the plugin options, please refer to Sidr github page.

Alternative

License

yii2-sidr-widget is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.