Your search did not match any results.
Slideout

Slideout

Documentation
The SlideOut widget is a classic slide-out menu paired with a view. A user opens the menu by swiping away the view. This demo shows how to group menu items and how to define custom templates for the view and group headers.
Copy to CodePen
Apply
Reset
window.onload = function() { function viewModel() { var that = this; that.swipeValue = ko.observable(true); that.menuVisible = ko.observable(true); that.products = products; that.toolbarItems = [{ location: "before", widget: "dxButton", options: { icon: "menu", onClick: function () { that.showMenu(); } } }, { location: "center", template: "title" }]; that.showMenu = function (e) { that.menuVisible(!that.menuVisible()); }; } ko.applyBindings(new viewModel(), document.getElementById("slideout")); };
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <script src="js/jquery-3.1.0.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.0/knockout-min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/17.1.6/css/dx.spa.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/17.1.6/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/17.1.6/css/dx.light.css" /> <link rel="dx-theme" data-theme="android5.light" href="https://cdn3.devexpress.com/jslib/17.1.6/css/dx.android5.light.css" /> <link rel="dx-theme" data-theme="ios7.default" href="https://cdn3.devexpress.com/jslib/17.1.6/css/dx.ios7.default.css" /> <link rel="dx-theme" data-theme="win10.black" href="https://cdn3.devexpress.com/jslib/17.1.6/css/dx.win10.black.css" /> <link rel="dx-theme" data-theme="win10.white" href="https://cdn3.devexpress.com/jslib/17.1.6/css/dx.win10.white.css" /> <script src="https://cdn3.devexpress.com/jslib/17.1.6/js/dx.all.js"></script> <script src="data.js"></script> <link rel="stylesheet" type ="text/css" href ="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div class="slideout-container" id="slideout"> <div data-bind="dxSlideOut: { dataSource: products, onItemClick: showMenu, menuVisible: menuVisible, swipeEnabled: swipeValue, menuGrouped: true }"> <div data-options="dxTemplate: { name: 'item' }"> <div data-bind="dxToolbar: { dataSource: $root.toolbarItems }"> <div data-options="dxTemplate: { name: 'title' }"> <p data-bind="text: $parent.text"></p> </div> </div> <div id="info"> <img data-bind="attr:{src: src}"> <h1 data-bind="text: price"></h1> </div> <div class="dx-fieldset"> <div class="dx-fieldset-header">Options</div> <div class="dx-field"> <div class="dx-field-label">Swipe to reveal the menu</div> <div class="dx-field-value" data-bind="dxSwitch: { value: $root.swipeValue }"></div> </div> </div> </div> <div data-options="dxTemplate: { name: 'menuGroup' }"> <b data-bind="text: key"></b> </div> </div> </div> </div> </body> </html>
#info { width: 200px; height: 200px; text-align: center; margin: 0 auto; margin-top: 10px; } #info img { width: 100%; } .slideout-container { height: auto; position: absolute; top: 0; bottom: 0; width:100%; } .dx-field-label { width: 70%; }
var products = [{ key: "Televisions", items: [ { text: "SuperLCD 42", price: "$1200", src: "../../../../images/products/7.png" }, { text: "SuperLED 42", price: "$1450", src: "../../../../images/products/5.png" }, { text: "SuperLED 50", price: "$1600", src: "../../../../images/products/4.png" }, { text: "SuperLCD 55", price: "$1350", src: "../../../../images/products/6.png" }, { text: "SuperLCD 70", price: "$4000", src: "../../../../images/products/9.png" } ] }, { key: "Monitors", items: [ { text: "DesktopLCD 19", price: "$160", src: "../../../../images/products/10.png" }, { text: "DesktopLCD 21", price: "$170", src: "../../../../images/products/12.png" }, { text: "DesktopLED 21", price: "$180", src: "../../../../images/products/13.png" } ] }, { key: "Projectors", items: [ { text: "Projector Plus", price: "$550", src: "../../../../images/products/14.png" }, { text: "Projector PlusHD", price: "$750", src: "../../../../images/products/15.png" } ] }, { key: "Video Players", items: [ { text: "HD Video Player", price: "$220", src: "../../../../images/products/1.png" }, { text: "SuperHD Video Player", price: "$270", src: "../../../../images/products/2.png" } ] } ];