【问题标题】:save jquery isotope filtering history保存 jquery 同位素过滤历史
【发布时间】:2013-02-20 12:13:18
【问题描述】:

我正在使用 Jquery isotope 来过滤我主页上的产品。

在我的页面上:http://osaiart.no/terrazzolys.php

我有不同的产品类别。问题是,如果您单击与第一个类别不同的​​类别,然后单击产品。当您点击后退按钮时,它不会识别您所在的类别。

有没有办法让它在你回去时识别出你所在的类别?

【问题讨论】:

    标签: jquery save history


    【解决方案1】:

    我不确定同位素本身是否提供了任何特定方法,但这就是我要做的。使用 javascript cookie 来存储所选类别的值。然后在页面加载时,您可以过滤掉像这样的其他产品

    $('#container').isotope({ filter: '.selected' });
    //filter out other products and show the only category that has the .selected class
    

    这是一个 cookie 插件,我通常会使用 https://github.com/carhartl/jquery-cookie 对于进一步的实现,比如使用后退按钮控制过滤等,您可以使用 html5 的历史 API 或类似这样的插件进行简单实现 - https://github.com/balupton/jquery-history

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-02-13
      • 1970-01-01
      • 2011-07-31
      • 2013-05-30
      • 2012-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多