Revision: 35033
Updated Code
at November 1, 2010 12:24 by mattluscombe
Updated Code
$(document).ready(function(){
// -- FILTER BY BRAND
// Hide all product info
$(".view-picked-products .views-row").hide();
// Click a brand name
$(".view-picked-products h3").click(function() {
// First hide any other expanded brands within the type (ie, Fridge)
$(this).parent().find(".views-row").hide();
// Then show the three product divs applicable to brand
$(this).next().show(); // First div
$(this).next().next().show(); // Second div
$(this).next().next().next().show(); // Third div
});
// -- FILTER BY PRODUCT
// Hide all product info (except for the serial number)
$(".view-picked-products .views-row > div:not(.views-field-field-serialnumber-value)").hide();
// Click a product's serial number
$(".view-picked-products .views-field-field-serialnumber-value").click(function() {
// First, hide any other expanded products within the type (ie, Fridge)
$(this).parent().parent().find(".views-row > div:not(.views-field-field-serialnumber-value)").hide();
// Then show the four extra product details
$(this).next().show(); // "Cost"
$(this).next().next().show(); // "RRP"
$(this).next().next().next().show(); // "Water rating"
$(this).next().next().next().next().show(); // "Energy rating"
// Lastly, stop the link from going to another page
return false;
});
});
Revision: 35032
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 1, 2010 12:05 by mattluscombe
Initial Code
$(document).ready(function(){
// -- FILTER BY BRAND
// Hide all product info
$(".view-picked-products .views-row").hide();
// Click a brand name
$(".view-picked-products h3").click(function() {
// First hide any other expanded brands within the type (ie, Fridge)
$(this).parent().find(".views-row").hide();
// Then show the three product divs applicable to brand
$(this).next().show(); // First div
$(this).next().next().show(); // Second div
$(this).next().next().next().show(); // Third div
});
// -- FILTER BY PRODUCT
// Hide all product info (except for the serial number)
$(".view-picked-products .views-row div:not(.views-field-field-serialnumber-value)").hide();
// Click a product's serial number
$(".view-picked-products .views-field-field-serialnumber-value").click(function() {
// First, hide any other expanded products within the type (ie, Fridge)
$(this).parent().parent().find(".views-row div:not(.views-field-field-serialnumber-value)").hide();
// Then show the four extra product details
$(this).next().show(); // "Cost"
$(this).next().next().show(); // "RRP"
$(this).next().next().next().show(); // "Water rating"
$(this).next().next().next().next().show(); // "Energy rating"
// Lastly, stop the link from going to another page
return false;
});
});
Initial URL
Initial Description
Initial Title
My Eco Home - Picked Products
Initial Tags
Initial Language
jQuery