small update to off canvas
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 10 Nov 2015 20:31:15 +0000 (15:31 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 10 Nov 2015 20:31:15 +0000 (15:31 -0500)
root/js/custom/pageSetup.js
root/lib/navigation.php

index dde383c..7b76e81 100644 (file)
@@ -12,8 +12,13 @@ $(document).ready(function () {
         var menuImg = $(this).parent('li').prop('id');
         var menuNum = menuImg.match(/\d+/)[0];
         var menuImgSrc = 'img_for_menu_' + menuNum;
-        $(this).find('li.image-placeholder').html('<img src="' + eval(menuImgSrc) + '">');
-        console.log('ul = ' + menuImg);
-        console.log('menu-id = ' + menuNum);
+        if (window['img_for_menu_' + menuNum]) {
+            $(this).find('li.image-placeholder').html('<img src="' + eval(menuImgSrc) + '">');
+        } else {
+            $(this).find('li.image-placeholder').parent('ul').addClass('no-image-subul');
+            $(this).find('li.image-placeholder').remove();
+        }
+        //console.log('ul = ' + menuImg);
+        //console.log('menu-id = ' + menuNum);
     });
 });
index a47a8a0..0c1b74d 100644 (file)
@@ -30,22 +30,25 @@ if ( ! function_exists( 'glm_theme_top_bar' ) ) {
  * Mobile off-canvas
  */
 if ( ! function_exists( 'glm_theme_mobile_off_canvas' ) ) {
-  function glm_theme_mobile_off_canvas() {
-      wp_nav_menu(array(
-          'container' => false,                           // remove nav container
-          'container_class' => '',                        // class of container
-          'menu' => '',                                   // menu name
-          'menu_class' => 'off-canvas-list',              // adding custom nav class
-          'theme_location' => 'top-bar',        // where it's located in the theme
-          'before' => '',                                 // before each link <a>
-          'after' => '',                                  // after each link </a>
-          'link_before' => '',                            // before each link text
-          'link_after' => '',                             // after each link text
-          'depth' => 5,                                   // limit the depth of the nav
-          'fallback_cb' => false,                         // fallback function (see below)
-          'walker' => new Glm_Theme_Off_Canvas_Walker()
-      ));
-  }
+    function glm_theme_mobile_off_canvas() {
+        echo '<div class="left-off-canvas-list">';
+        echo '<ul><li class="page_item"><a href="' . get_bloginfo('url') . '">Home</a></li>';
+        wp_nav_menu(array(
+            'container' => false,                           // remove nav container
+            'container_class' => '',                        // class of container
+            'menu' => '',                                   // menu name
+            'menu_class' => 'off-canvas-list',              // adding custom nav class
+            'theme_location' => 'top-bar',        // where it's located in the theme
+            'before' => '',                                 // before each link <a>
+            'after' => '',                                  // after each link </a>
+            'link_before' => '',                            // before each link text
+            'link_after' => '',                             // after each link text
+            'depth' => 5,                                   // limit the depth of the nav
+            'fallback_cb' => false,                         // fallback function (see below)
+            'walker' => new Glm_Theme_Off_Canvas_Walker()
+        ));
+        echo '</ul></div>';
+    }
 }
 
 /**