2017 © Pedro Peláez
 

yii2-extension yii2-slideout-widget

The SlideOut widget is a wrapper around the slideout.js plugin, a touch slideout navigation menu for your mobile web apps

image

raoul2000/yii2-slideout-widget

The SlideOut widget is a wrapper around the slideout.js plugin, a touch slideout navigation menu for your mobile web apps

  • Thursday, March 12, 2015
  • by raoul2000
  • Repository
  • 2 Watchers
  • 2 Stars
  • 201 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 3 % Grown

The README.md

yii2-slideout-widget

The Slideout widget is a wrapper around the slideout.js plugin,, (*1)

...A touch slideout navigation menu for your mobile web apps., (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

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

or add, (*5)

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

to the require section of your composer.json file., (*6)

Usage

Using Slideout widget is easy : you need some markup and some CSS (snippets below are retrieved from the sideout.js demo site) :, (*7)

The markup, (*8)

<nav id="menu">
  <header>
    <h2>Menu</h2>
  </header>
</nav>

<main id="panel">
  <header>
    <h2>Panel</h2>
  </header>
</main>

The CSS, (*9)

html,
body {
  width: 100%;
  height: 100%;
}

.slideout-menu {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
  z-index: 0;
  width: 256px;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  display: none;
}

.slideout-panel {
  position:relative;
  z-index: 1;
}

.slideout-open,
.slideout-open body {
  overflow: hidden;
}

.slideout-open .slideout-menu {
  display: block;
}

And then eventually, the Slideout widget, and somewhere in the page a button to open/close the menu :, (*10)

 [
        'panel' =>  new yii\web\JsExpression("document.getElementById('panel')"),
        'menu' => new yii\web\JsExpression("document.getElementById('menu')"),
        'padding' => 256,
        'tolerance' => 70
    ]
]); 

?>

<button onclick="yii2_raoul2000_slideout.toggle();">toggle menu</button>

The javascript variable yii2_raoul2000_slideout has been created by the widget so you can access the slideout menu instance from anywhere in the page. In the example above, the onclick handler invokes toggle() which is part of the slideout API., (*11)

You may also note that both option panel and menu are expected to be JS objects (and not selectors)., (*12)

For more information on the plugin options, please refer to slideout github page., (*13)

Alternative

License

yii2-slideout-widget is released under the BSD 3-Clause License. See the bundled LICENSE.md for details., (*14)

The Versions

12/03 2015

dev-master

9999999-dev

The SlideOut widget is a wrapper around the slideout.js plugin, a touch slideout navigation menu for your mobile web apps

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget menu side mobile scrolling