SoFunction
Updated on 2025-04-11

Implementation method of using ionic to play polling ads (must-read)

Use the ion-slide-box implementation in ionic, and the following is a complete code example:

<!DOCTYPE html>
<html ng-app="app">
<head>
  <meta charset="utf-8">
  <title>ionic-demo</title>
  <link href="../lib/ionic/css/" rel="external nofollow" rel="stylesheet">
  <script type="text/javascript" src="../lib/ionic/js/" charset="utf-8"></script>
  
  <style type="text/css">
  {
    width: 100%;
    height: 320px;
  }
   > img{
    width: 100%;
    height: 100%;
  }
  </style>  
</head>
<body ng-controller="ctrl">
    <ion-view>
     <ion-content>
     <ion-slide-box on-slide-changed="slideHasChanged($index)" auto-play="true" does-continue="true" slide-interval=2000 show-pager="true" pager-click="pageClick(index)" active-slide="" delegate-handle="delegateHandler">
     <ion-slide>
      <div class="box blue" ui-sref="list" >
       <img src="/pfpghc2/201609/28/">
      </div>
     </ion-slide>
     <ion-slide>
      <div class="box yellow">
       <img src="/n/news/20161003//">
      </div>
     </ion-slide>
     <ion-slide>
      <div class="box pink">
       <img src="/n/news/20161003//">
      </div>
     </ion-slide>
    </ion-slide-box>
     </ion-content>  
    </ion-view>  
  <script type="text/javascript">
  var app = ('app',['ionic']);
  
  ('ctrl', function($scope,$ionicSlideBoxDelegate,$state) {
    //In order to verify the model defined by the property active-slide, angularjs is the mvc pattern     $ = {
      activeIndex:1
     };

    //This event corresponds to the pager-click attribute. When the displayed image has a corresponding number of small dots, this is the click event of small dots.     $ = function(index){
      $ = 2;
     };

    // This event is triggered after the image is switched     $ = function($index){
     };
     //This is used for verification of the property delegate-handle. In fact, there is no need to redefine it. Just use $ionicSlideBoxDelegate directly     $ = $ionicSlideBoxDelegate;
  })
  </script>
</body>
</html>

The above method of using ionic to play polling advertisements (must read) is all the content I share with you. I hope you can give you a reference and I hope you can support me more.