关于调用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
});
答案 0 :(得分:0)
从这个快速看看,你的tab1是否有一个像tab2定义的点击事件? 例如:
$(".tab1").click(function () {
initialize_mixitup('#your_books_image_gallery', '#yourbook_switchtogrid', '#yourbook_switchtolist', '.mix_book', '.book_sort', 'grid', '');
});
答案 1 :(得分:0)
通过使用容器类替换两个容器的容器ID来解决问题。