混合起来在 tab1 中不起作用,但在另一个选项卡中工作,即 chrome 和移动设备中的 tab2

Mix it up is not working in tab1 but working in another tab i.e tab2 in chrome and mobile devices

关于调用 mixitup 函数的文档就绪代码

if ($('.tab1').hasClass('active')) {
    initialize_mixitup('#mixitup_image_search_gallery', '#switchtogrid', '#switchtolist', '.mix_image', '.image_sort', 'grid', '');
}
$(".tab2").click(function () {
    initialize_mixitup('#your_books_image_gallery', '#yourbook_switchtogrid', '#yourbook_switchtolist', '.mix_book', '.book_sort', 'grid', '');
});


function initialize_mixitup(mixitup_container, grid_button, list_button, target_class, sort_class, default_layout, mix_callback) {
var layout = default_layout,
        $mixitupContainer = $(mixitup_container),
        $gridButton = $(grid_button),
        $listButton = $(list_button);

$mixitupContainer.mixItUp({
    selectors: {target: target_class, sort: sort_class},
    animation: {animateChangeLayout: true, animateResizeTargets: true, effects: 'fade rotateX(-40deg) translateZ(-100px)'},
    layout: {containerClass: default_layout},
    callbacks: mix_callback
});

快速查看一下,您的 tab1 是否像 tab2 一样定义了点击事件? 示例:

$(".tab1").click(function () {
    initialize_mixitup('#your_books_image_gallery', '#yourbook_switchtogrid', '#yourbook_switchtolist', '.mix_book', '.book_sort', 'grid', '');
});

通过将两个容器的容器 ID 替换为容器 class 解决了问题。