//init $('#pathwayCarouselBox').carousel({ interval: false, wrap: false }); //down pop var $imageListPathway = $('#pathwayCarouselBox'); var $thisIndexPathway = 0; $('#pathwayCarouselBox .btn-prev').on('click',function(){ $thisIndexPathway --; $thisIndexPathway = $thisIndexPathway <= 0 ? 0 : $thisIndexPathway; $(".pathway-picture-mask .carousel").carousel('prev'); fnUpdateStylePathway($thisIndexPathway); }); $('#pathwayCarouselBox .btn-next').on('click',function(){ $thisIndexPathway ++; $thisIndexPathway = $thisIndexPathway >= $imageListPathway.find('li').length -1 ? $imageListPathway.find('li').length -1 : $thisIndexPathway; $(".pathway-picture-mask .carousel").carousel('next'); fnUpdateStylePathway($thisIndexPathway); }); function fnUpdateStylePathway($thisIndexPathway){ if($thisIndexPathway <= 0){ $('#pathwayCarouselBox .btn-prev').addClass('first') }else { $('#pathwayCarouselBox .btn-prev').removeClass('first') } if($thisIndexPathway >= $imageListPathway.find('li').length -1){ $('#pathwayCarouselBox .btn-next').addClass('last') }else { $('#pathwayCarouselBox .btn-next').removeClass('last') } } // active verification function cellPicture (itemId){ var thisImg = $(itemId).find('.image-count'); $.each($(thisImg),function(i, item){ $(this).on('click',function (){ var proSourceIdx = $(this).attr("pro-source-idx"); var objTemp = $('#pathwayCarouselBox'); if (itemId === '.cpd-carousel'){ $('#pathwayCarouselBox').parent().css({"display": "flex"}); } $.each(objTemp.find("li"), function(i, item){ if(proSourceIdx == i){ $(item).addClass('active'); }else{ $(item).removeClass('active'); } }); $thisIndexPathway = i; fnUpdateStylePathway($thisIndexPathway); }); }); } cellPicture('.cpd-carousel'); function hideMask($clickEle) { $($clickEle).hide(); } $('.close-model').on('click',function (){ hideMask('.pathway-picture-mask'); }); $('.pathway-picture-mask .picture-content').on('click',function(e){ e.stopPropagation(); }); $('.pathway-picture-mask,.close-model').on('click',function (){ hideMask('.pathway-picture-mask'); }); $(function () { // $('.cpd-carousel .active-verification li').each(function(i, item){ // var imgValue = $(item).find('img').attr('src'); // //var descVal = $(item).find('.activity-desc span').html(); // $('#pathwayCarouselBox .carousel-item').eq(i).find('img').attr('src',imgValue); // //$('#pathwayCarouselBox .carousel-item').eq(i).find('.activity-desc span').html(descVal); // }); $('.activity-desc').each(function (i, dom) { var descValue = $(dom).text(); if(descValue === ''){ $(dom).css('visibility','hidden'); } }); });