同位素过滤器从另一个页面链接 [英] isotope filter to link from another page

查看:133
本文介绍了同位素过滤器从另一个页面链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <$ c我正在研究jquery的同位素,过滤器工作正常,使用下面给出的方法portfolio.html: $ c>< li class =current>< a href =#data-filter =*>全部< / a>< / li> 
< li>< a href =#data-filter =。design> design< / a>< / li>
< a>< a href =#data-filter =。coding>编码< / a>< / li>
< li>< a href =#data-filter =。logo>徽标< / a>< / li>

我想要实现的是链接到一个特定的类别,以便我的用户可以从其他页面过滤的类别。



我尝试了下面的链接方法,但是没有成功:

 < a href =portfolio.html#filter = logodata-filter =。logo> logo< / a> 

任何人都可以帮我吗?是否有任何方法来预先筛选类别?

解决方案

配置同位素后,您需要阅读查询字符串变量,然后单击匹配的过滤器按钮。



jsFiddle示例: http:// jsfiddle.net/Y6vWn/

  var filterFromQuerystring = getParameterByName('filter'); 
$('a [data-filter =。'+ filterFromQuerystring +']')。click();


i'm working on jquery isotope and the filter works just fine using the method given below on the same page portfolio.html:

<li class="current"><a href="#" data-filter="*">all</a></li>
<li><a href="#" data-filter=".design">design</a></li>
<li><a href="#" data-filter=".coding">coding</a></li>
<li><a href="#" data-filter=".logo">logo</a></li>

What i'm trying to achieve is to link to a specific category so that my users can come from other pages to the filtered category.

i tried the following linking method but it didn't work:

<a href="portfolio.html#filter=logo" data-filter=".logo">logo</a>

can anyone help me out? is there any method to pre-filter the categories?

解决方案

After you configure isotope you need to read the querystring variable and then click the filter button that matches.

jsFiddle Example: http://jsfiddle.net/Y6vWn/

var filterFromQuerystring = getParameterByName('filter');
$('a[data-filter=".' + filterFromQuerystring  + '"]').click();

这篇关于同位素过滤器从另一个页面链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆