2016-01-15 04:09:11 +03:00
|
|
|
function clearDrawerClasses($container) {
|
2016-01-19 23:56:33 +03:00
|
|
|
var classes = ["mdb-drawer-pos-f-l", "mdb-drawer-pos-f-r", "mdb-drawer-pos-f-t", "mdb-drawer-pos-f-b"];
|
2016-01-15 04:09:11 +03:00
|
|
|
|
2016-01-15 22:53:30 +03:00
|
|
|
$.each(classes, function (index, value) {
|
2016-01-15 04:09:11 +03:00
|
|
|
$container.removeClass(value)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2016-01-15 22:53:30 +03:00
|
|
|
function setDrawerPosition(position) {
|
2016-01-15 04:09:11 +03:00
|
|
|
var $container = $('.mdb-layout-container')
|
|
|
|
|
|
|
|
clearDrawerClasses($container)
|
|
|
|
$container.addClass(position)
|
|
|
|
}
|
|
|
|
|
2016-01-15 22:53:30 +03:00
|
|
|
$(document).ready(function() { // document ready is a little convoluted because this executes before jquery.
|
2016-01-19 23:56:33 +03:00
|
|
|
var buttons = ["drawer-pos-f-l", "drawer-pos-f-r", "drawer-pos-f-t", "drawer-pos-f-b"]
|
2016-01-15 04:09:11 +03:00
|
|
|
|
2016-01-15 22:53:30 +03:00
|
|
|
$.each(buttons, function (index, position) {
|
|
|
|
$('#' + position).click(function() {
|
|
|
|
setDrawerPosition('mdb-' + position)
|
2016-01-15 04:09:11 +03:00
|
|
|
})
|
2016-01-15 22:53:30 +03:00
|
|
|
})
|
2016-01-15 05:59:54 +03:00
|
|
|
|
2016-01-15 22:53:30 +03:00
|
|
|
// add a toggle for drawer visibility that shows anytime
|
|
|
|
$('#drawer-visibility').click(function () {
|
|
|
|
var $container = $('.mdb-layout-container')
|
|
|
|
|
|
|
|
// once clicked, just do away with responsive marker
|
2016-01-19 23:17:08 +03:00
|
|
|
//$container.removeClass('mdb-drawer-in-md')
|
2016-01-15 22:53:30 +03:00
|
|
|
|
2016-01-21 02:10:34 +03:00
|
|
|
var $btn = $(this)
|
|
|
|
var $icon = $btn.find('.material-icons')
|
2016-01-21 02:47:37 +03:00
|
|
|
if ($icon.text() == 'visibility') {
|
2016-01-21 02:10:34 +03:00
|
|
|
$container.addClass('mdb-drawer-out') // demo only, regardless of the responsive class, we want to force it close
|
2016-01-21 02:47:37 +03:00
|
|
|
$icon.text('visibility_off')
|
2016-01-21 02:10:34 +03:00
|
|
|
$btn.attr('title', 'Drawer allow responsive opening')
|
2016-01-15 22:53:30 +03:00
|
|
|
}
|
|
|
|
else {
|
2016-01-21 02:10:34 +03:00
|
|
|
$container.removeClass('mdb-drawer-out') // demo only, regardless of the responsive class, we want to force it open
|
2016-01-21 02:47:37 +03:00
|
|
|
$icon.text('visibility')
|
2016-01-21 02:10:34 +03:00
|
|
|
$btn.attr('title', 'Drawer force closed')
|
2016-01-15 22:53:30 +03:00
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
2016-01-15 05:59:54 +03:00
|
|
|
|