summaryrefslogtreecommitdiffstats
path: root/user_guide_src
diff options
context:
space:
mode:
authorInstructor, Computer Systems Technology <jim_parry@bcit.ca>2015-10-21 15:10:32 +0200
committerAndrey Andreev <narf@devilix.net>2015-10-21 15:25:06 +0200
commit29b90f7ea402b9d8227fff86e32ab13de056b6c1 (patch)
tree8727312ba8764bb69b84f22d0cf85fba0224244f /user_guide_src
parenta7d4abaedc27497d570ae06ddc9cdde05930ec15 (diff)
Merge pull request #4167 from zhanghongyi/fix-pulldown
disable pulldown menu on mobile devices
Diffstat (limited to 'user_guide_src')
-rw-r--r--user_guide_src/source/_themes/sphinx_rtd_theme/static/css/citheme.css15
-rw-r--r--user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js36
2 files changed, 46 insertions, 5 deletions
diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/static/css/citheme.css b/user_guide_src/source/_themes/sphinx_rtd_theme/static/css/citheme.css
index 192af2004..a2a3b3e91 100644
--- a/user_guide_src/source/_themes/sphinx_rtd_theme/static/css/citheme.css
+++ b/user_guide_src/source/_themes/sphinx_rtd_theme/static/css/citheme.css
@@ -70,4 +70,19 @@ div#pulldown-menu {
font-weight: 300;
font-family: Lucida Grande,Verdana,Geneva,sans-serif;
color: #aaaaaa;
+}
+
+/*hide pulldown menu on mobile devices*/
+@media (max-width: 768px) { /*tablet size defined by theme*/
+ #closeMe {
+ display: none;
+ }
+
+ #pulldown {
+ display: none;
+ }
+
+ #openToc {
+ display: none;
+ }
} \ No newline at end of file
diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js
index b77789d06..081d77bdf 100644
--- a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js
+++ b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js
@@ -25,7 +25,7 @@ $(document).ready(function () {
$('#closeMe').toggle(
function ()
{
- setCookie('ciNav', true, 365);
+ setCookie('ciNav', 'yes', 365);
$('#nav2').show();
$('#topMenu').remove();
$('body').css({background: 'none'});
@@ -35,7 +35,7 @@ $(document).ready(function () {
},
function ()
{
- setCookie('ciNav', false, 365);
+ setCookie('ciNav', 'no', 365);
$('#topMenu').remove();
$('#nav').hide();
$('#nav2').hide();
@@ -44,20 +44,25 @@ $(document).ready(function () {
$('.wy-nav-side').show();
}
);
- if (getCookie('ciNav') == 'true')
+ if (getCookie('ciNav') == 'yes')
{
$('#closeMe').trigger('click');
//$('#nav').slideToggle();
}
// END MODIFICATION ---
+
});
// Rufnex Cookie functions
function setCookie(cname, cvalue, exdays) {
+ // expire the old cookie if existed to avoid multiple cookies with the same name
+ if (getCookie(cname)) {
+ document.cookie = cname + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
+ }
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toGMTString();
- document.cookie = cname + "=" + cvalue + "; " + expires;
+ document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/";
}
function getCookie(cname) {
var name = cname + "=";
@@ -70,10 +75,31 @@ function getCookie(cname) {
return c.substring(name.length, c.length);
}
}
- return false;
+ return '';
}
// End
+// resize window
+$(window).on('resize', function(){
+ // show side nav on small screens when pulldown is enabled
+ if (getCookie('ciNav') == 'yes' && $(window).width() <= 768) { // 768px is the tablet size defined by the theme
+ $('.wy-nav-side').show();
+ }
+ // changing css with jquery seems to override the default css media query
+ // change margin
+ else if (getCookie('ciNav') == 'no' && $(window).width() <= 768) {
+ $('.wy-nav-content-wrap').css({'margin-left': 0});
+ }
+ // hide side nav on large screens when pulldown is enabled
+ else if (getCookie('ciNav') == 'yes' && $(window).width() > 768) {
+ $('.wy-nav-side').hide();
+ }
+ // change margin
+ else if (getCookie('ciNav') == 'no' && $(window).width() > 768) {
+ $('.wy-nav-content-wrap').css({'margin-left': '300px'});
+ }
+});
+
window.SphinxRtdTheme = (function (jquery) {
var stickyNav = (function () {
var navBar,