$(function() { $require(['swiper'], function() { var s_swiper = new swiper('.s-list .swiper-container', { // speed:500, autoplay: false, navigation: { nextel: '.s-list .swiper-button-next', prevel: '.s-list .swiper-button-prev', }, }); var h_list=[]; $('.solve .s-list .swiper-container .swiper-slide ul li').click(function() { $('.solve .s-list .swiper-container .swiper-slide ul li').removeclass('active'); $(this).addclass('active'); var title=$(this).find('h3').text(); var html_title=$(this).find('.t-title').html(); var html_text= $(this).find('.hide-text .t-b').html(); var html_swiper=''; $(this).closest('.a_list').find('.hide-li ul li').each(function (i,v) { var name=$(this).data('name'); if(name==title){ html_swiper+=$(v).html(); } }); var html='
'+html_title+'
'+html_text+'
'+html_swiper+'
'; $('.show-text').empty().html(html).show(); var n=parseint($('.show-text .n').text())+1; $('.show-text .n').text('0'+n); var h_swiper = new swiper('.h-swiper',{ autoplay:false, watchoverflow: true, pagination: { el: '.h-swiper .swiper-pagination', }, navigation: { nextel: '.h-swiper .swiper-button-next', prevel: '.h-swiper .swiper-button-prev', }, }); }); $('.show-text').on('click', '.closes', function() { $('.show-text').empty().hide(); $('.solve .s-list .swiper-container .swiper-slide ul li').removeclass('active'); }); $('.case-list h4').click(function() { var index = $(this).index(); $(this).addclass('active').siblings().removeclass('active'); $(this).closest('.swiper-slide').find('.s-tu img').eq(index).show().siblings().hide(); $(this).closest('.swiper-slide').find('.u .ul').eq(index).show().siblings().hide(); }); function getquerystring(name) { var reg = new regexp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); var r = window.location.search.substr(1).match(reg); if (r != null) { return unescape(r[2]); } return null; } var i = getquerystring("i"); var j = getquerystring("j"); if(i&&j){ s_swiper.slideto(i); $('.solve .swiper-slide-active .case-list h4').eq(j).addclass('active').siblings().removeclass('active'); $('.solve .swiper-slide-active .s-tu img').eq(j).show().siblings().hide(); $('.solve .swiper-slide-active .u .ul').eq(j).show().siblings().hide(); }else{ if (i) { s_swiper.slideto(i); } } }) })