轻触afterChange事件未在移动设备上触发

时间:2017-03-10 10:15:13

标签: javascript angularjs mobile

我想在光滑滑块的afterChange事件上触发我的自定义函数,我应用了以下代码,它在桌面上工作,但在移动设备上没有响应。在桌面上,光滑的afterChange事件触发,而在移动中,afterChange事件不会触发,因此我的自定义函数不起作用。

$('.slider').on('afterChange', function(event, slick, currentSlide, nextSlide){
                
    $scope.slickIndex = currentSlide;
    $('.dots').find('#photobookdiv'+$scope.slickIndex).click();
    $scope.selectedLeft = $scope.slickIndex;
    

});



$scope.clickDot = function(index){
    $scope.slickIndex = index;
    $('.slick-dots').find('#slick-slide0'+index).click();
}
<slick class="product-slider slider clearfix" ng-if="isData3Loaded" infinite=true slides-to-show=3 slides-to-scroll=1 dots=true autoplay=true responsive="breakpoints">

<div class="slick-item" id="photobook-div{{$index}}" ng-click="selectedProductByPreviewType($event,product.code,$index); activate(arrCategoryType); setClickedLeft($index)" ng-modal="product.categoryProduct" ng-repeat="product in arrCategoryType"  >
      
    
        <div class="for-link-content-page">
          <figure>
            <img ng-src="{{product.thumb_image}}" alt="{{product.alt}}" title="{{product.alt}}">
          </figure>
          <div>
            <strong>{{product.ProductCat}}<span>{{product.onlineText}}</span></strong>
            <small class="photobook-product-small-box"><b ng-if="$index != 2">{{'pb_hard_cover' | translate}} | {{'pb_soft_cover' | translate}}</b><b ng-if="false">{{'pb_soft_cover' | translate}}</b></small>
            <small>{{product.onlineDescription }}</small>
            <a  ng-href="/{{ product.categoryUrl }}"><span class="more-info-book">{{product.more_info}} </span></a>
          </div>
        </div>
      </div>

    </slick>
    <div class="clearfix"></div>
    <ul class="dots" style="display: block;position: relative;bottom: 0;" role="tablist">
      <li id="photobookdiv{{$index}}" ng-modal="product.categoryProduct" ng-repeat="product in arrCategoryType" ng-click="selectedProductByPreviewType($event,product.code,$index);  activate(arrCategoryType); setClickedLeft($index); clickDot($index)" ng-class="{'active':$index == selectedLeft}">
       
      </li>
    </ul>

0 个答案:

没有答案