$(function(){ $('.proCon .title ul li').click(function(){ var index =$(this).index(); $('.proCon .title ul li').removeClass("active"); $('.proCon .title ul li').eq(index).addClass("active"); $('.proCon .list .item').removeClass("active"); $('.proCon .list .item').eq(index).addClass("active"); }) $('.caseShow .title img').click(function(){ $('.caseShow').hide(400); }) var page = 0 $('.case ul li').click(function(){ page = $(this).index(); var that = $(this); var src= $(that).find(".img img").attr('src'); var title = $(that).find('.text p').text(); $('.caseShow .box .list .img img').attr('src',src); $('.caseShow .box .dis p').text(title); $('.caseShow').show(400,function(){ $(this).css("display","flex") }); }) $('.caseShow .list .prev').click(function(){ if(page <=0){ console.log('没有了'); }else{ page --; var src= $('.case ul li').eq(page).find(".img img").attr('src'); var title = $('.case ul li').eq(page).find('.text p').text(); $('.caseShow .box .list .img img').attr('src',src); $('.caseShow .box .dis p').text(title); } }) $('.caseShow .list .next').click(function(){ var mun = $('.case ul li').length; console.log(mun); if(page >=(mun - 1)){ console.log('没有了'); }else{ page ++; var src= $('.case ul li').eq(page).find(".img img").attr('src'); var title = $('.case ul li').eq(page).find('.text p').text(); $('.caseShow .box .list .img img').attr('src',src); $('.caseShow .box .dis p').text(title); } }) $('.clickImg img').click(function(){ var src = $(this).attr('src'); $('.showMo').find('img').attr('src',src); $('.showMo').css('display','flex'); }) $('.showMo').click(function(){ $(this).css('display','none'); }) })