From ef7e36e4fd2a168977754f0aac1d855fb651f104 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Fri, 29 Jun 2012 18:27:23 +0200
Subject: [PATCH] make mobile javascript work correctly on orientation change

---
 lib/tpl/dokuwiki/script.js | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/tpl/dokuwiki/script.js b/lib/tpl/dokuwiki/script.js
index b31d3dc08..75575608b 100644
--- a/lib/tpl/dokuwiki/script.js
+++ b/lib/tpl/dokuwiki/script.js
@@ -1,10 +1,14 @@
-jQuery(function(){
-    // check if we are in mobile mode
-    if(jQuery('div.mobileTools').css('display') == 'none') return;
+function tpl_dokuwiki_mobile(){
+    // check if we are in mobile or tablet mode be sure to adjust the number
+    // here when adjusting it in the css
+    if(document.body.clientWidth > 979) return;
 
     // toc and sidebar hiding
     dw_page.makeToggle('#dokuwiki__aside h3.toggle','#dokuwiki__aside div.content');
 
     jQuery('#dw__toc h3.toggle').click();
     jQuery('#dokuwiki__aside h3.toggle').show().click();
-});
+}
+
+jQuery(tpl_dokuwiki_mobile);
+jQuery(window).bind('resize',tpl_dokuwiki_mobile);
-- 
GitLab