触发混合滤​​镜OnLoad [英] Trigger Mixitup Filters OnLoad

查看:83
本文介绍了触发混合滤​​镜OnLoad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ExpressionEngine上使用Mixitup( https://mixitup.kunkalabs.com )实用程序地点.该页面列出了房地产属性,而Mixitup过滤器用于按区域,特征等缩小这些属性.

I'm using the Mixitup (https://mixitup.kunkalabs.com) utility on an ExpressionEngine site. The page is a listing of real estate properties, and the Mixitup filter is to narrow down those properties by region, features, etc.

我希望能够通过url_segment传递一些值来触发过滤器.因此,例如,如果用户单击从划分为多个市场的地图中的列表,则他们只会首先看到那些市场中的属性,就像他们是从主页中选择的一样.

I want to be able to pass some values via url_segment to trigger the filters. So, for example, if a user clicks the listings from a map divided into various markets, they'll see only the properties in those markets first, as if they had selected it from the main page.

例如,默认视图是这样:

For example, the default view is this:

如果他们单击印第安纳中部",其他地区将消失,并打开一个子市场菜单:

If they click on Central Indiana, the other regions go away, and a submarket menu opens:

如果他们进一步单击South,则仅显示该子市场中的属性.他们可以随时取消选择这些选项,并显示隐藏的属性.

If they further click on South, only the properties in that submarket are displayed. At any time, they can deselect those options, and the hidden properties are revealed.

我想做的就是让用户能够使用已选择的某些选项来访问该页面:

What I want to do is have the ability for users to visit that page with some options already selected:

在进行所有其他调用之后,我尝试使用javascript单击元素:

I tried using a javascript to click the elements, after all other calls were made:

<script>
     $(document).ready(function(e){
          setTimeout(function() {
               $("li.central-indiana").click();
          },10);
     });
</script>

这扩展了菜单,但没有过滤属性(或应用活动"类,但这并不是真正的问题).

That expanded the menus, but didn't filter the properties (or apply the "active" class, but that's not really the problem).

我还尝试在页面末尾使用Mixitup的showOnLoad函数,并且还使用了延迟计时器:

I also tried using Mixitup's showOnLoad function at the end of the page, and also with a delay timer:

<script type="text/javascript">
    $("document").ready(function() {
        setTimeout(function() {
             $('#filter').mixitup(
                {'showOnLoad': 'central-indiana'}
             ); 
        },10);   
    });
</script>

这会暂时过滤掉属性,但是mixitup会重置自身,并显示所有属性.它还没有展开菜单或应用活动"类.

That momentarily filtered the properties, but then mixitup reset itself, and displayed them all. It also did not expand the menus or apply the "active" class.

我在这里想念什么?

谢谢

ty

推荐答案

您需要设置一些要在加载时进行过滤的内容,例如:

You need to set something to be filtered on load, like this:

$(function() {
    $('#filter').mixItUp({
        load: {
            filter: '.central-indiana'
        }
    });
});

这篇关于触发混合滤​​镜OnLoad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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