javascript - Update a jQuery script when user switches to a new tabbed element -
i'm having hard time describing problem is.. link in question is: http://www.evolutionarycollective.com/events/
you'll notice when load "calendar" tab, calendar doesn't show up. if resize window, or manipulate page in other way, calendar appears. calendar loads fine when it's not within tab. it's being called in header with:
<script type='text/javascript'> jquery(document).ready(function() { jquery('#calendar').fullcalendar({ events: themeforce.events }); }); </script>
edit: believe section of script library handles tabs , panes.. (i'm using wordpress theme calls tabs via shortcode)
// jquery tool's tab creator not shortcode friendly, transfer titles correct tabs area jquery('.bfi_pane').each(function(i) { var title = jquery(this).attr('title'); jquery(jquery(this).siblings('.bfi_tabs,.bfi_tabs_slide,.bfi_tabs_fade')[0]).append('<div><a href="#">'+title+'</a></div>'); }); // custom slide effect tabs. slide down jquery.tools.tabs.addeffect('slide-slide',function(i, done) { this.getpanes().slideup(400).eq(i).delay(400).slidedown(400, done); }); // custom slide effect tabs. slide , down simultaneously jquery.tools.tabs.addeffect("slide", function(i, done) { this.getpanes().slideup(400).eq(i).slidedown(400, done); }); // important: slidedown jquery fix. need assign correct heights // slidedown effect doesn't jump jquery(".bfi_accordion_pane").each(function(i) { var heightto = jquery(this).height(); var paddingtop = parseint(jquery(this).css("padding-top").replace('px', '')); var paddingbottom = parseint(jquery(this).css("padding-bottom").replace('px', '')); var margintop = parseint(jquery(this).css("margin-top").replace('px', '')); var marginbottom = parseint(jquery(this).css("margin-bottom").replace('px', '')); jquery(this).css("height", heightto + paddingtop + paddingbottom + margintop + marginbottom); }); // start jquery tool tabs. have long way can make // initialindex work jquery(".bfi_tabs_slide").each(function(i) { var opentab = jquery(this).attr('rel'); jquery(this).tabs('> div.bfi_pane', {effect: 'slide-slide', initialindex: parseint(opentab, 10)}); }); jquery(".bfi_tabs_fade").each(function(i) { var opentab = jquery(this).attr('rel'); jquery(this).tabs('> div.bfi_pane', {effect: 'fade', initialindex: parseint(opentab, 10)}); });
is there way can somehow refresh script when tab lis loaded.. or fire off document.ready?
thank you!
the probable explanation full calendar can't figure out height because when created tab hidden, make have 0 width , height.
just make call .fullcalendar()
in tab switch event handler.
alternatively use "off-left" method of hiding tabs, described in last few paragraphs of http://jqueryui.com/demos/tabs/
Comments
Post a Comment