2016-01-26 21:12:48 +03:00
|
|
|
function clearDrawerClasses($container) {
|
2016-03-21 17:56:51 +03:00
|
|
|
var classes = ["bmd-drawer-f-l", "bmd-drawer-f-r", "bmd-drawer-f-t", "bmd-drawer-f-b"];
|
2016-01-26 21:12:48 +03:00
|
|
|
|
|
|
|
$.each(classes, function (index, value) {
|
|
|
|
$container.removeClass(value)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function setDrawerPosition(position) {
|
2016-03-21 17:56:51 +03:00
|
|
|
var $container = $('.bmd-layout-container')
|
2016-01-26 21:12:48 +03:00
|
|
|
|
|
|
|
clearDrawerClasses($container)
|
|
|
|
$container.addClass(position)
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
var buttons = ["drawer-f-l", "drawer-f-r", "drawer-f-t", "drawer-f-b"]
|
|
|
|
|
|
|
|
$.each(buttons, function (index, position) {
|
|
|
|
$('#' + position).click(function() {
|
2016-03-21 17:56:51 +03:00
|
|
|
setDrawerPosition('bmd-' + position)
|
2016-01-26 21:12:48 +03:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
// add a toggle for drawer visibility that shows anytime
|
|
|
|
$('#drawer-visibility').click(function () {
|
2016-03-21 17:56:51 +03:00
|
|
|
var $container = $('.bmd-layout-container')
|
2016-01-26 21:12:48 +03:00
|
|
|
|
|
|
|
// once clicked, just do away with responsive marker
|
2016-03-21 17:56:51 +03:00
|
|
|
//$container.removeClass('bmd-drawer-in-md')
|
2016-01-26 21:12:48 +03:00
|
|
|
|
|
|
|
var $btn = $(this)
|
|
|
|
var $icon = $btn.find('.material-icons')
|
|
|
|
if ($icon.text() == 'visibility') {
|
2016-03-21 17:56:51 +03:00
|
|
|
$container.addClass('bmd-drawer-out') // demo only, regardless of the responsive class, we want to force it close
|
2016-01-26 21:12:48 +03:00
|
|
|
$icon.text('visibility_off')
|
|
|
|
$btn.attr('title', 'Drawer allow responsive opening')
|
|
|
|
}
|
|
|
|
else {
|
2016-03-21 17:56:51 +03:00
|
|
|
$container.removeClass('bmd-drawer-out') // demo only, regardless of the responsive class, we want to force it open
|
2016-01-26 21:12:48 +03:00
|
|
|
$icon.text('visibility')
|
|
|
|
$btn.attr('title', 'Drawer force closed')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|