Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zzossig/hugo-theme-zdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials/head/scripts.html')
-rw-r--r--layouts/partials/head/scripts.html42
1 files changed, 36 insertions, 6 deletions
diff --git a/layouts/partials/head/scripts.html b/layouts/partials/head/scripts.html
index 957a1a9..83e00b0 100644
--- a/layouts/partials/head/scripts.html
+++ b/layouts/partials/head/scripts.html
@@ -12,6 +12,9 @@
<script>
"use strict";
+ {{ $languagedir := ($.Param "languagedir" | default "ltr") }}
+ var languagedir = JSON.parse({{ $languagedir | jsonify }});
+
window.onload = function() {
// ===================== navbar collapse ======================
var navCollapseBtn = document.getElementById('navCollapseBtn');
@@ -92,12 +95,22 @@
content.style.maxHeight = null;
content.classList.remove('active');
menuTitleIcon.classList.add('right');
- menuTitleIcon.classList.remove('down');
+
+ if (languagedir === 'rtl') {
+ menuTitleIcon.classList.remove('downrtl');
+ } else {
+ menuTitleIcon.classList.remove('down');
+ }
} else {
content.style.maxHeight = content.scrollHeight + "px";
content.classList.add('active');
menuTitleIcon.classList.remove('right');
- menuTitleIcon.classList.add('down');
+
+ if (languagedir === 'rtl') {
+ menuTitleIcon.classList.add('downrtl');
+ } else {
+ menuTitleIcon.classList.add('down');
+ }
}
});
});
@@ -111,16 +124,33 @@
var drawerCloseBtn = document.querySelector('.drawer__close');
var openDrawer = function() {
- modal.style.left = 0;
modal.style.opacity = 1;
- drawer.style.left = 0;
+
+ if (languagedir === 'rtl') {
+ modal.style.right = 0;
+ drawer.style.right = 0;
+ } else {
+ modal.style.left = 0;
+ drawer.style.left = 0;
+ }
}
var closeDrawer = function() {
modal.style.opacity = 0;
- drawer.style.left = '-100%';
+
+ if (languagedir === 'rtl') {
+ drawer.style.right = '-100%';
+ } else {
+ drawer.style.left = '-100%';
+ }
+
+
setTimeout(function () {
- modal.style.left = '-100%';
+ if (languagedir === 'rtl') {
+ modal.style.right = '-100%';
+ } else {
+ modal.style.left = '-100%';
+ }
}, 250);
}