ksachdeva / angular-swiper

Angular directive for nolimits4web/Swiper
Apache License 2.0
197 stars 94 forks source link

AutoPlay dosen't work? #53

Open Turifan opened 7 years ago

Turifan commented 7 years ago

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">

{{list.companyName}}
    </ks-swiper-container>`
brh55 commented 7 years ago

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 commented 7 years ago

It can work when I add $timeout in the code

Get Outlook for iOShttps://aka.ms/o0ukef

On Thu, Nov 17, 2016 at 2:15 AM +0800, "Brandon Him" notifications@github.com<mailto:notifications@github.com> wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ksachdeva/angular-swiper/issues/53#issuecomment-261025823, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AP5UrFThk1k8kQ39tKSgEM-yhG_osSQkks5q-0gbgaJpZM4KVrPd.

WillisYe commented 7 years ago

add ng-if, My code follow: `

    </ks-swiper-container>`
fbanyai commented 5 years ago

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.