Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoPlay dosen't work? #53

Open
Turifan opened this issue Oct 13, 2016 · 4 comments
Open

AutoPlay dosen't work? #53

Turifan opened this issue Oct 13, 2016 · 4 comments

Comments

@Turifan
Copy link

Turifan commented Oct 13, 2016

I used angular-swiper in my project, but AutoPlay dosen't work. My code follow:

Please suggest me how i can make it work, thanks!
<ks-swiper-container slides-per-view="1" slides-per-column="1" space-between="0" pagination-is-active="true" pagination-clickable="true" show-nav-buttons="false" loop="true" autoplay="2000" initial-slide="0" direction="horizontal"> <ks-swiper-slide class="swiper-slide" ng-repeat="list in listBean"> <a ng-href="{{list.companyURL}}"> <img ng-src="/{{list.companyImg}}" alt="{{list.companyName}}" class="img-responsive"> </a> </ks-swiper-slide> </ks-swiper-container>

@brh55
Copy link
Contributor

brh55 commented Nov 16, 2016

The issue maybe with ng-repeat/dynamically loading images. Does autoplay continue to work when you resize the browser after you finish loading images?

@Turifan
Copy link
Author

Turifan commented Nov 28, 2016 via email

@WillisYe
Copy link

add ng-if, My code follow:
<ks-swiper-container ng-if="home.bannerContent[0] && home.bannerContent[0].content.length>0" autoplay="3000" loop="true" on-ready="onReadySwiper(swiper)" pagination-is-active="true" > <ks-swiper-slide class="swiper-slide" ng-repeat="item in home.bannerContent[0].content"> <a ng-href="{{item.linkUrl}}"> <img ng-src="{{item.imgUrl}}" alt="" /> </a> </ks-swiper-slide> </ks-swiper-container>

@fbanyai
Copy link

fbanyai commented Nov 29, 2018

For anyone still struggling with this issue please notice that currently Swiper itself expects an object (w/ delay as one of its properties).

And angular-swiper does a type checking to make sure the param is a number.

if (!angular.isUndefined($scope.autoplay) && typeof $scope.autoplay === 'number') {
    params = angular.extend({}, params, {
        autoplay: $scope.autoplay
    });
}

So it's impossible to get the autoplay to work without updating angular-swiper source to avoid this type check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants