ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
50.94k stars 13.52k forks source link

bug: Slidebox dosen't continue auto play when the time switch to other view is over the slide interval and then return this carousel view #4537

Closed floraluo closed 8 years ago

floraluo commented 8 years ago

I have the issue that slidebox can't automatically play, when I click the tab switch to another view and come back. Note,this switch interval is greater than slide interval Type: bug

Platform: desktop browser

https://github.com/floraluo/ioncus/blob/master/www/templates/tab-home.html

<ion-slide-box on-slide-changed="slideChanged(index)" does-continue="true" auto-play="true" 
slide-interval="2000" show-pager="false" pager-click="pagerClick(index)" >
            <ion-slide>
                <img src="img/ionic.png">
            </ion-slide>
            <ion-slide>
              <h3>Using Awesome</h3>

              <div id="list">
                <h5>Just three steps:</h5>
                <ol>
                  <li>Be awesome</li>
                  <li>Stay awesome</li>
                  <li>There is no step 3</li>
                </ol>
              </div>
            </ion-slide>
            <ion-slide>
              <h3>Any questions?</h3>
              <p>
                Too bad!
              </p>
            </ion-slide>
        </ion-slide-box>

https://github.com/floraluo/ioncus/blob/master/www/js/controller.js

hxzAugustinus commented 8 years ago

active-slide="index" ,maybe you need to add this attr

floraluo commented 8 years ago

@hxzAugustinus thank you for your answer,but it's still have this issue when I add the attr

mlynch commented 8 years ago

Hey everyone, we just landed a new slider component that solves this issue. It's in master and will be in 1.2 To use it today, do this:

Will be back porting the delegate to work with it soon, but going to close since this should be solved now.

<ion-slides options="options" slider="data.slider">
  <ion-slide-page>
  </ion-slide-page>
</ion-slides>

and your JS:

controller('MyCtrl', function($scope) {
      $scope.options = {
        loop: true
      }

      $scope.data = {};

      $scope.$watch('data.slider', function(nv, ov) {
        $scope.slider = $scope.data.slider;
      })

});