Javascript 页面加载后在初始启动时对可见项进行混合计数
我正在玩分类项目 我可以在按下排序或筛选按钮后对可见的项目进行计数:Javascript 页面加载后在初始启动时对可见项进行混合计数,javascript,jquery,sorting,mixitup,Javascript,Jquery,Sorting,Mixitup,我正在玩分类项目 我可以在按下排序或筛选按钮后对可见的项目进行计数: $('#collection').on('mixEnd', function(e, state){ var countvisible = $("#container> tr[style='']").length; console.log('Sorted! ' + countvisible ); $('#current_count').text(countvisible); }); 我需要的是:
$('#collection').on('mixEnd', function(e, state){
var countvisible = $("#container> tr[style='']").length;
console.log('Sorted! ' + countvisible );
$('#current_count').text(countvisible);
});
我需要的是:获取页面加载上可见项目的计数
但是在页面加载的mixitup初始化过程中,'on('mixEnd')不会触发
怎么做?我可以在PageLoad上使用,
等待一些延迟,但这似乎不是一个好的做法
感谢您的帮助。我知道现在有点晚了,但如果能帮上忙,我会从中找到答案 这是一个很大的问题,但在你的情况下,你只需要:
$('#collection').on('mixEnd', function(e, state) {
$('#current_count').html(state.totalShow);
});
状态。totalShow
是键;) 是否尝试使用可见选择器
$('#collection').on('mixEnd', function(e, state){
var countvisible = $("#container> tr[style='']:visible").length;
console.log('Sorted! ' + countvisible );
$('#current_count').text(countvisible);
});