summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/tpl/dokuwiki/script.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/tpl/dokuwiki/script.js b/lib/tpl/dokuwiki/script.js
index d32cf5cff..5badb5859 100644
--- a/lib/tpl/dokuwiki/script.js
+++ b/lib/tpl/dokuwiki/script.js
@@ -4,17 +4,23 @@ function tpl_dokuwiki_mobile(){
var $handle = jQuery('#dokuwiki__aside h3.toggle');
var $toc = jQuery('#dw__toc h3');
if(document.body.clientWidth > 979) {
- console.log('desktop');
// reset for desktop mode
- $handle[0].setState(1);
- $handle.hide();
- $toc[0].setState(1);
+ if($handle.length) {
+ $handle[0].setState(1);
+ $handle.hide();
+ }
+ if($toc.length) {
+ $toc[0].setState(1);
+ }
} else {
- console.log('mobile');
// toc and sidebar hiding
- $handle.show();
- $handle[0].setState(-1);
- $toc[0].setState(-1);
+ if($handle.length) {
+ $handle.show();
+ $handle[0].setState(-1);
+ }
+ if($toc.length) {
+ $toc[0].setState(-1);
+ }
}
}