2019-09-30 15:38:41 +03:00
|
|
|
/**
|
|
|
|
* Expand or close the sidebar in mobile screens.
|
2020-01-02 16:17:49 +03:00
|
|
|
* v2.0
|
|
|
|
* https://github.com/cotes2020/jekyll-theme-chirpy
|
2019-09-30 15:38:41 +03:00
|
|
|
* © 2018-2019 Cotes Chung
|
|
|
|
* MIT License
|
|
|
|
*/
|
|
|
|
|
2020-04-16 19:26:58 +03:00
|
|
|
$(function() {
|
|
|
|
|
|
|
|
var sidebarUtil = (function() {
|
|
|
|
const ATTR_DISPLAY = "sidebar-display";
|
|
|
|
var isExpanded = false;
|
2020-08-19 07:26:45 +03:00
|
|
|
var body = $("body");
|
2019-09-30 15:38:41 +03:00
|
|
|
|
|
|
|
return {
|
2020-08-19 07:26:45 +03:00
|
|
|
toggle() {
|
|
|
|
if (isExpanded === false) {
|
|
|
|
body.attr(ATTR_DISPLAY, "");
|
2020-04-16 19:26:58 +03:00
|
|
|
} else {
|
|
|
|
body.removeAttr(ATTR_DISPLAY);
|
|
|
|
}
|
|
|
|
|
|
|
|
isExpanded = !isExpanded;
|
2019-09-30 15:38:41 +03:00
|
|
|
}
|
2020-08-19 07:26:45 +03:00
|
|
|
};
|
2020-04-16 19:26:58 +03:00
|
|
|
|
2020-08-19 07:26:45 +03:00
|
|
|
}());
|
2019-09-30 15:38:41 +03:00
|
|
|
|
2020-04-16 19:26:58 +03:00
|
|
|
$("#sidebar-trigger").click(sidebarUtil.toggle);
|
2019-09-30 15:38:41 +03:00
|
|
|
|
2020-08-19 07:26:45 +03:00
|
|
|
$("#mask").click(sidebarUtil.toggle);
|
2019-09-30 15:38:41 +03:00
|
|
|
|
2020-04-16 19:26:58 +03:00
|
|
|
});
|