0

I am currently working a project using an altered version of isotope filtering. There is a portfolio gallery on a subpage, which is filterable with isotope jquery filter. I am using jQuery 1.8.3.

What I am trying to do, is to put a deeplink to a specific portfolio category on the front page. I would like to add a hashtag and have it being recognized by jQuery, which then fires an event to simulate a click on the filter button according to the hashtag.

Everything works fine, except for the click.

This is my code for the click event (I've sorted out the other stuff, which is working fine anyway):

    jQuery(document).ready(function($) {
jQuery(jQuery("a[data-value='cat1']")[0]).trigger("click");
});

What am I doing wrong?

4

1 回答 1

0

您需要使用 .on()

看看这个文档。

http://api.jquery.com/on/

于 2013-06-10T14:56:02.827 回答