Returning the original JS for the brand dropdowns
authorlaury <laury@gaslightmedia.com>
Tue, 11 Sep 2018 14:35:04 +0000 (10:35 -0400)
committerlaury <laury@gaslightmedia.com>
Tue, 11 Sep 2018 14:35:04 +0000 (10:35 -0400)
js/custom/pageSetup.js
parts/manufacturers.php

index 9a20a60..eefc93f 100644 (file)
@@ -32,24 +32,24 @@ $(document).ready(function () {
     });
 
     if( $(window).width() > 786){
-        //$('.manufacturer-brand').attr('data-options',"is_hover:true" );
+        $('.manufacturer-brand').attr('data-options',"is_hover:true" );
         $(document).foundation('dropdown', 'reflow');
     }else{
-        // $('.glm-rv-brand').each(function(){
-        //     let url = $(this).children('a').attr('href');
-        //     $(this).attr('data-url', url);
-        // })
-        // $('.glm-rv-brand').on("click", function(){
-        //     window.location = $(this).data('url');
-        // })
-        // $('.manufacturer-brand').each(function(){
-        //     let url = $(this).children('a').attr('href');
-        //     if( $(this).children('ul').length <= 0 || $(this).children('ul').css("touch-action") === "manipulation"){
-        //         // $(this).attr('data-url', url);
-        //         $(this).on("click", function(){
-        //             window.location = url;
-        //         })
-        //     }
-        // })
+        $('.glm-rv-brand').each(function(){
+            let url = $(this).children('a').attr('href');
+            $(this).attr('data-url', url);
+        })
+        $('.glm-rv-brand').on("click", function(){
+            window.location = $(this).data('url');
+        })
+        $('.manufacturer-brand').each(function(){
+            let url = $(this).children('a').attr('href');
+            if( $(this).children('ul').length <= 0 || $(this).children('ul').css("touch-action") === "manipulation"){
+                // $(this).attr('data-url', url);
+                $(this).on("click", function(){
+                    window.location = url;
+                })
+            }
+        })
     }
 });
index 8757505..49d180b 100644 (file)
@@ -26,7 +26,7 @@ unset($manufacturers['RV Classes']);
                         }
                 } ?>
             
-                <li class="manufacturer-brand">
+            <li class="manufacturer-brand"  data-dropdown="<?php echo sanitize_title($manufacturer); ?>">
 
                     <?php if ($block->url){ ?> 
                         <a href="<?php echo $block->url; ?>"> 
@@ -34,6 +34,19 @@ unset($manufacturers['RV Classes']);
 
                     <?php apply_filters('glm_block_image', $block->ID); ?>
                     <?php if ($block->url){ ?> </a> <?php } ?>
+                    -                    <?php $class = false; ;?>
+                    <?php if(count($manufacturers[$manufacturer]) < 4 ) { $class = "one_col";} else { $class = "two_col";} ?>
+                        <?php if( isset($manufacturers[$manufacturer] ) && !empty($manufacturers[$manufacturer]) ){ ?>
+                        <ul id="<?php echo sanitize_title($manufacturer); ?>"class="glm-rv-brand-list f-dropdown <?php echo $class; ?>" data-dropdown-content">
+                            <?php foreach($manufacturers[$manufacturer] as $key=>$value){ ?>
+                                <li class="glm-rv-brand">
+                                    <a href="<?php echo $block->url; ?>&categorySearchMultiple[]=<?php echo $value['id']; ?>">
+                                        <?php echo $value['brand']; ?>
+                                    </a>
+                                </li>
+                            <?php } ?>
+                        </ul>
+                    <?php } ?>
                 </li>
 
             <?php } ?>