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

How to use swiperEvents like 'slideChange' ? #33

Open
caiodesign opened this issue Jun 12, 2018 · 2 comments
Open

How to use swiperEvents like 'slideChange' ? #33

caiodesign opened this issue Jun 12, 2018 · 2 comments

Comments

@caiodesign
Copy link

caiodesign commented Jun 12, 2018

Hello!
Someone knows how to use swiperEvents like 'slideChange' using ui-swiper without edit 'node-packages' files?

Default:

var mySwiper = new Swiper('.swiper-container', {
  // ...
};
mySwiper.on('slideChange', function () {
  console.log('slide changed');
});

Thanks!

@craftystudio
Copy link

I use it like this to toggle content on based on slide index, maybe it will help

html

<swiper on-slide-change-start="yourScope">
        ...
</swiper>
...
<div ng-show="your2ndScope === 0">
        ...
</div>
<div ng-show="your2ndScope === 1">
        ...
</div>

controller

$scope.yourScope = function (swiper) {
        $scope.your2ndScope = swiper.activeIndex;
        console.log(swiper.activeIndex);
};

@Mathijs003
Copy link

What if you want to access scope variables in a controller?

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

3 participants