2016-01-15 04:09:11 +03:00
|
|
|
function clearDrawerClasses($container) {
|
2016-01-15 22:53:30 +03:00
|
|
|
var classes = ["mdb-drawer-fixed-left", "mdb-drawer-fixed-right", "mdb-drawer-fixed-top", "mdb-drawer-fixed-bottom"];
|
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.
|
|
|
|
var buttons = ["drawer-fixed-left", "drawer-fixed-right", "drawer-fixed-top", "drawer-fixed-bottom"]
|
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
|
|
|
|
//$container.removeClass('mdb-drawer-open-md')
|
|
|
|
|
|
|
|
var $icon = $(this).find('.material-icons')
|
|
|
|
if ($icon.text() == 'visibility_off') {
|
|
|
|
$container.addClass('mdb-drawer-closed')
|
|
|
|
$container.removeClass('mdb-drawer-open') // demo only, regardless of the responsive class, we want to force it close
|
|
|
|
$icon.text('visibility')
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$container.removeClass('mdb-drawer-closed')
|
|
|
|
$container.addClass('mdb-drawer-open') // demo only, regardless of the responsive class, we want to force it open
|
|
|
|
$icon.text('visibility_off')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
2016-01-15 05:59:54 +03:00
|
|
|
|