added comments and changed display style for filters
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 28 Dec 2015 18:45:26 +0000 (13:45 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 28 Dec 2015 18:45:26 +0000 (13:45 -0500)
js/app.js
js/custom/upcp.js

index 8530760..0ecd75f 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -35,6 +35,7 @@ $(document).ready(function () {
             location.reload();
         });
     }
+    // hide product display initially
     if ((window.location.href.indexOf("products-2/?michsci_category") >= 0)){
         $("#productsView").css("display", "inherit");
         $("#categoriesView").css("display", "none");
@@ -56,7 +57,7 @@ $(document).ready(function () {
             window.location.href =  window.location.pathname;
         });
     }
-    // change output view
+    // change output view from list to grid
     if (!(window.location.href.indexOf("products-2/?pagename") >= 0)) {
     $("#grid").on("click", function (e) {
         document.cookie = "view=grid";
@@ -75,17 +76,23 @@ $(document).ready(function () {
         return $(this).css('clear') == 'both';
     }).remove();
 
+    // show products if filter is selected else only display categories
     $("#tagBox :checkbox").click(function() {
         $(".product").hide();
+        $("#gridView").css("display", "inherit");
+        $("#listView").css("display", "inherit");
         $("#categoriesGridView").hide();
         $("3categoriesListView").hide()
         $("#tagBox :checkbox:checked").each(function() {
             $("." + $(this).val()).show();
         });
+        // hide products on front page, show all products if on products page
         if($("#tagBox :checkbox:checked").length === 0){
             $(".product").show();
             $("#categoriesGridView").show();
             $("#categoriesListView").show();
+            $("#gridView").css("display", "none");
+            $("#listView").css("display", "none");
         }
     });
 });
index cfd04e2..ea3291d 100644 (file)
@@ -15,6 +15,7 @@ $(document).ready(function () {
             location.reload();
         });
     }
+    // hide product display initially
     if ((window.location.href.indexOf("products-2/?michsci_category") >= 0)){
         $("#productsView").css("display", "inherit");
         $("#categoriesView").css("display", "none");
@@ -36,7 +37,7 @@ $(document).ready(function () {
             window.location.href =  window.location.pathname;
         });
     }
-    // change output view
+    // change output view from list to grid
     if (!(window.location.href.indexOf("products-2/?pagename") >= 0)) {
     $("#grid").on("click", function (e) {
         document.cookie = "view=grid";
@@ -55,17 +56,23 @@ $(document).ready(function () {
         return $(this).css('clear') == 'both';
     }).remove();
 
+    // show products if filter is selected else only display categories
     $("#tagBox :checkbox").click(function() {
         $(".product").hide();
+        $("#gridView").css("display", "inherit");
+        $("#listView").css("display", "inherit");
         $("#categoriesGridView").hide();
         $("3categoriesListView").hide()
         $("#tagBox :checkbox:checked").each(function() {
             $("." + $(this).val()).show();
         });
+        // hide products on front page, show all products if on products page
         if($("#tagBox :checkbox:checked").length === 0){
             $(".product").show();
             $("#categoriesGridView").show();
             $("#categoriesListView").show();
+            $("#gridView").css("display", "none");
+            $("#listView").css("display", "none");
         }
     });
 });