added jquery to switch between category and product view
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 21 Dec 2015 21:16:53 +0000 (16:16 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 21 Dec 2015 21:16:53 +0000 (16:16 -0500)
js/app.js
js/custom/upcp.js
page.php

index abf0db5..4d4f88f 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -22,6 +22,15 @@ $(document).ready(function () {
 $(document).ready(function () {
     "use strict";
     
+    // don't display products on the main "products page"
+    if ((window.location.href.indexOf("products-2") >= 0)){
+        $("#productsView").css("display", "none");
+    }
+    if ((window.location.href.indexOf("products-2/?michsci_category") >= 0)){
+        $("#productsView").css("display", "inherit");
+        $("#categoriesView").css("display", "none");
+    }
+    
     // navigate back to products page if on product page
     if ((window.location.href.indexOf("products-2/?pagename") >= 0)) {
 //        $("#viewBtns").css("display", "none");
@@ -36,7 +45,6 @@ $(document).ready(function () {
     }
   
     // change output view
-   
     if (!(window.location.href.indexOf("products-2/?pagename") >= 0)) {
     $("#grid").on("click", function (e) {
         document.cookie = "view=grid";
@@ -47,7 +55,6 @@ $(document).ready(function () {
             location.reload();
         });
     }
-  
         $("#categoryDropdown").change(function() {
             $("#catSubmit").submit();
         });
index ab6e832..c1d7394 100644 (file)
@@ -2,6 +2,15 @@
 $(document).ready(function () {
     "use strict";
     
+    // don't display products on the main "products page"
+    if ((window.location.href.indexOf("products-2") >= 0)){
+        $("#productsView").css("display", "none");
+    }
+    if ((window.location.href.indexOf("products-2/?michsci_category") >= 0)){
+        $("#productsView").css("display", "inherit");
+        $("#categoriesView").css("display", "none");
+    }
+    
     // navigate back to products page if on product page
     if ((window.location.href.indexOf("products-2/?pagename") >= 0)) {
 //        $("#viewBtns").css("display", "none");
@@ -16,7 +25,6 @@ $(document).ready(function () {
     }
   
     // change output view
-   
     if (!(window.location.href.indexOf("products-2/?pagename") >= 0)) {
     $("#grid").on("click", function (e) {
         document.cookie = "view=grid";
@@ -27,7 +35,6 @@ $(document).ready(function () {
             location.reload();
         });
     }
-  
         $("#categoryDropdown").change(function() {
             $("#catSubmit").submit();
         });
index a57d297..7882e2b 100644 (file)
--- a/page.php
+++ b/page.php
@@ -17,6 +17,7 @@
                 <div id="page-title">
                     <h1><?php echo get_the_title(); ?></h1>
                 </div>
+               
 <!--
                 <button id="list"type="button">list</button> 
                 <button id="grid" type="button">Grid</button>