JQuery流沙:直接链接到另一个页面上的预过滤流沙 [英] JQuery Quicksand: Link directly to pre-filtered Quicksand from another page
本文介绍了JQuery流沙:直接链接到另一个页面上的预过滤流沙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如:如果我有一个名为Fruit.php的页面,带有Quicksand,并且过滤器为"All","Apple"和"Bananas",并且默认情况下将其设置为"All",那么我可以链接到fruit了吗? php来自其他页面,并且已将流沙预先过滤为"Apple"或"Banana"?
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?
推荐答案
如果您设置了诸如fruit.php#apple之类的链接,则可以编写一些JavaScript来解析主题标签并过滤页面加载时的集合:>
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
});
}
这篇关于JQuery流沙:直接链接到另一个页面上的预过滤流沙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文