Skip to content

Instantly share code, notes, and snippets.

@hayatbiralem
Last active December 15, 2015 08:29
Show Gist options
  • Save hayatbiralem/5231146 to your computer and use it in GitHub Desktop.
Save hayatbiralem/5231146 to your computer and use it in GitHub Desktop.
Just a simple solution for refresh CarouFredSel dimensions after tabs changed...
$(".tab_content").hide();
$(".tab_content:first").show();
$("ul.tablar li").click(function () {
$("ul.tablar li").removeClass("active");
$(this).addClass("active");
$(".tab_content").hide();
var index = $("ul.tablar li").index(this);
// $('.tab_content').eq(index).fadeIn(500);
$('.tab_content').eq(index).css({opacity:"0", display: "block"}); // show tab and set opacity 0
$('#slayt'+(index+1)).trigger('updateSizes'); // refresh dimensions
$('.tab_content').eq(index).css({opacity:"1", display: "none"}).fadeIn(500); // fade animation after hide tab and set opacity 1
});
$('#slayt1').carouFredSel({
auto: {timeoutDuration : 5000, pauseOnHover: 'resume'},
prev: '#prev1',
next: '#next1'
});
$('#slayt2').carouFredSel({
auto: {timeoutDuration : 5000, pauseOnHover: 'resume'},
prev: '#prev2',
next: '#next2'
});
$('#slayt3').carouFredSel({
auto: {timeoutDuration : 5000, pauseOnHover: 'resume'},
prev: '#prev3',
next: '#next3'
});
@marlocorridor
Copy link

Thanks for this. I have found a way to update the carousel size. 😄
$('#faces').trigger('updateSizes')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment