First open limited item not all in jQuery Quicksan

2019-06-14 05:05发布

问题:

jQuery Quicksand

I want to first open limited item like "vogue". in here ist open "all" What the change in the programs? Please help me

For looking go here1

go here2

回答1:

If you don't want all to show all items when you open the page, you can call the .quicksand() function for .vouge on page load, to trigger the filtering/animation.

Since the example with "vogue" is not trivial, I chose to reuse the click event handler. Put this code last in your javascript.

$(function() {
    // It would be better to create a function for this, but
    // to avoid code duplication the click() event is triggered/reused
    $('#filterOptions li a.vogue').click();
});

This is of course only a quick fix. It would be better to create a proper function of the contents of the click event, and call the function both on load and on click.