gpt4 book ai didi

javascript - jquery Quicksand 链接到预过滤页面

转载 作者:行者123 更新时间:2023-12-02 19:40:04 25 4
gpt4 key购买 nike

我正在使用 jquery fastsand,我想知道如何返回到列表已预先排序的页面。我对 javascript 不太了解,因此我们将不胜感激。

编辑

找到了类似过滤器的解决方案 http://savethefix.wordpress.com/2011/12/06/filterable-portfolio-with-jquery-with-external-link-support/

但不知道如何将其与流沙结合起来

最佳答案

弄清楚是否有人感兴趣。

$(document).ready(function() {


// get the action filter option item on page load
var $filterType = $('#filterOptions li.active a').attr('class');

// get and assign the ourHolder element to the
// $holder varible for use later
var $holder = $('ul.ourHolder');

// clone all items within the pre-assigned $holder element
var $data = $holder.clone();

var $button = $('#filterOptions li');

var $all = $('ul.ourHolder li').data('type') === 'all';


if (window.location.hash) {
// reset the active class on all the buttons
$button.removeClass('active');

// assign the class of the clicked filter option
// element to our $filterType variable
var $filtered = window.location.hash.replace('#', '');

$('a[class=' + $filtered + ']').parent().addClass('active');

var $filteredData = $data.find('li[data-type~=' + $filtered + ']').show();

// call quicksand and assign transition parameters
$holder.quicksand($filteredData, {
duration: 800,
easing: 'easeInOutQuad'
});
}
// attempt to call Quicksand when a filter option
// item is clicked
// Main Filter
$('#filterOptions li a').on('click', function(e) {
// reset the active class on all the buttons
$button.removeClass('active');

// assign the class of the clicked filter option
// element to our $filterType variable
var $filterType = $(this).attr('class');
$(this).parent().addClass('active');

var $filterData = $data.find('li[data-type~=' + $filterType + ']').show();

// call quicksand and assign transition parameters
$holder.quicksand($filterData, {
duration: 800,
easing: 'easeInOutQuad'
});
});

//Main Containers
$('ul.ourHolder').on('click', 'li.all', function(e) {
// reset the active class on all the buttons
$button.removeClass('active');

// assign the class of the clicked filter option
// element to our $filterType variable
var $ba = $('#filterOptions li a');
var $filteringType = $(this).attr('id');
var $navFilter = $ba.attr('class');

var $filteringData = $data.find('li[data-type=' + $filteringType + ']').show();

// call quicksand and assign transition parameters
$holder.quicksand($filteringData, {
duration: 800,
easing: 'easeInOutQuad'
});
});
});

关于javascript - jquery Quicksand 链接到预过滤页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10491313/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com