jQuery(function($){ /* ============================================== Accordion =============================================== */ $('.panel-title').find('a').click(function(e){ $('.panel-title').find('a').parent('h6').removeClass('panel-active'); $(this).parent('h6').addClass('panel-active'); if($(this).parents('.panel').children('.panel-collapse').hasClass('in')){ e.stopPropagation(); e.preventDefault(); } }); $('.panel-group').children('.panel:first-child').find('.panel-collapse').addClass('in'); $('.panel-group').children('.panel:first-child').find('.panel-title').addClass('panel-active'); /* ============================================== Tabs =============================================== */ $('.nav-tabs').find('li:first-child').addClass('active'); $('.tab-content').find('.tab-pane:first-child').addClass('active'); $('.free-content-wrap').find('.tab-wrap').each(function(){ $(this).find('.nav-tabs li').eq(0).addClass('active'); }); $('.free-content-wrap').find('.tab-content').each(function(){ $(this).find('.tab-pane').eq(0).addClass('active'); }); /* ============================================== Accordion =============================================== */ $('.free-content').find('.panel-title').eq(0).addClass('panel-active'); $('.free-content').find('.panel-collapse').eq(0).addClass('in'); /* ============================================== Content Slider =============================================== */ var postSlider = new Swiper('.blog-post-slider',{ loop:true, speed:500 }); $('.post-slider-left').on('click', function(e){ e.preventDefault() postSlider.swipePrev() }); $('.post-slider-right').on('click', function(e){ e.preventDefault() postSlider.swipeNext() }); var contentHeight=$('.blog-post-slider .swiper-slide-active').find('img').height(); $('.blog-post-slider').css({ height:contentHeight+'px' }); $(window).resize(function(){ var contentHeight=$('.blog-post-slider .swiper-slide-active').find('img').height(); $('.blog-post-slider').css({ height:contentHeight+'px' }); }); $('.swiper-slide,.post-slider-right,.post-slider-left').click(function(){ var contentHeight=$('.blog-post-slider .swiper-slide-active').find('img').height(); $('.blog-post-slider').css({ height:contentHeight+'px' }); }); });