Javascript 在内容交换js中触发同位素重新播放
我有一个简单的内容交换脚本:Javascript 在内容交换js中触发同位素重新播放,javascript,jquery,jquery-isotope,Javascript,Jquery,Jquery Isotope,我有一个简单的内容交换脚本: $(function(){ function contentSwitcher(settings){ var settings = { contentClass : '.project-view', navigationId : '#projects-nav' }; //Hide all of the content except the first one on the nav $(settings.c
$(function(){
function contentSwitcher(settings){
var settings = {
contentClass : '.project-view',
navigationId : '#projects-nav'
};
//Hide all of the content except the first one on the nav
$(settings.contentClass).not(':first').hide();
$(settings.navigationId).find('li:first').addClass('active');
//onClick set the active state,
//hide the content panels and show the correct one
$(settings.navigationId).find('a').click(function(e){
var contentToShow = $(this).attr('href');
contentToShow = $(contentToShow);
//dissable normal link behaviour
e.preventDefault();
//set the proper active class for active state css
$(settings.navigationId).find('li').removeClass('active');
$(this).parent('li').addClass('active');
//hide the old content and show the new
$(settings.contentClass).hide();
contentToShow.show();
$container.isotope('reLayout');
});
}
contentSwitcher();
}))
我正试图在它里面添加一个同位素重新释放的触发器
$container.isotope('reLayout');
但我似乎无法触发它。初始选项卡加载良好,但第二个选项卡已全部折叠。我做错了什么?JSFIDLE有助于排除故障。看起来您可能正在使用一个不推荐使用的同位素功能-同位素的新版本将“relayat”选项更改为“layout”。试着改变
$container.isotope('reLayout');
。。。到
$container.isotope('layout');
JSFIDLE将有助于进行故障排除。看起来您可能正在使用一个不推荐使用的同位素功能-同位素的新版本将“relayat”选项更改为“layout”。试着改变
$container.isotope('reLayout');
。。。到
$container.isotope('layout');
你用的是哪种同位素。或者,您可以使用append方法将项目添加到容器中:您使用的同位素版本是什么。或者,您可以使用append方法将项目添加到容器中: