Slider not working properly in bootstrap tabs
-
Hi, I have two tabs with carousel inside but it doesn’t work.
My html:<ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"><a href="#tab-1" aria-controls="tab-1" role="tab" data-toggle="tab">Tab 1</a></li> <li role="presentation"><a href="#tab-2" aria-controls="tab-2" role="tab" data-toggle="tab">Tab 2</a></li> </ul> <div class="tab-content"> <div role="tabpanel" class="tab-pane active" id="tab-1"> <div class=”title”>Title 1</div> <div class=”slider”><?php echo do_shortcode ( ); ?></div> </div> <div role="tabpanel" class="tab-pane" id="tab-2"> <div class=”title”>Title 2</div> <div class=”slider”><?php echo do_shortcode ( ); ?></div> </div> </div>
But inactive slider won’t work. When I click on tab title shows up but carousel doesn’t, unless I manually re-size the window.
I tried adding JS below but it doesn’t work.jQuery(function($) { $(".nav-tabs a").each(function() { var $this = $(this); $this.click(function (e) { e.preventDefault(); $this.tab("show"); $(window).trigger("resize"); }); }); });
Any idea how to fix this?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Slider not working properly in bootstrap tabs’ is closed to new replies.