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
|
|
|
|
|
|
|
var $icon = $(this).find('.material-icons')
|
|
|
|
if ($icon.text() == 'visibility_off') {
|
2016-01-19 23:17:08 +03:00
|
|
|
$container.removeClass('mdb-drawer-in') // demo only, regardless of the responsive class, we want to force it close
|
2016-01-15 22:53:30 +03:00
|
|
|
$icon.text('visibility')
|
|
|
|
}
|
|
|
|
else {
|
2016-01-19 23:17:08 +03:00
|
|
|
$container.addClass('mdb-drawer-in') // demo only, regardless of the responsive class, we want to force it open
|
2016-01-15 22:53:30 +03:00
|
|
|
$icon.text('visibility_off')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
2016-01-15 05:59:54 +03:00
|
|
|
|