For example: If I have a page called fruit.php with Quicksand and the filters are 'All', 'Apple', and 'Bananas' and it is set to 'All' by default, can I link to fruit.php from some other page and have quicksand pre-filtered to 'Apple' or 'Banana' instead?
Asked
Active
Viewed 1,002 times
1 Answers
1
If you set up your links like fruit.php#apple, you can write some javascript to parse the hashtag and filter the collection on the page load:
if(window.location.hash) {
// run code here to filter the quicksand set
var $filteredData = $data.find('li[data-type=' + window.location.hash + ']');
$applications.quicksand($filteredData, {
duration: 800
});
}

Emily
- 304
- 3
- 6
-
1Emily, you did very well to help me along in this; thanks! I'm sure there's better ways of doing this, but for my instance, a few things to note: window.location.hash includes the "#" char; window.location.hash.substring(1) fixes that; watch the scope of the $data and $applications variables and you'll probably want to class your visual elements that reflect the selection. I can post more info if there's interest. – Screenack Mar 06 '12 at 19:24