Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html ng-app="ionicApp">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
  <title>Test</title>
  <link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet">
  <script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
</head>


<body ng-controller="Ctrl">
  <ion-header-bar class="bar-positive">
    <button class="button button-small button-clear icon icon-left ion-chevron-left button-chevron-font-size" ng-click="slidePrevious()">&nbsp;Prev</button>
    <h1 class="title">Ionic ion-slides (Swiper)  - page {{data.currentPage}}</h1>
     <button class=" button button-small button-clear icon icon-right ion-chevron-right button-chevron-font-size" ng-click="slideNext()">Next&nbsp;</button>
  </ion-header-bar>

  <ion-slides options="data.sliderOptions" slider="data.sliderDelegate">
    <ion-slide-page ng-repeat="bgColor in data.bgColors">
      <div class="box {{bgColor}}"></div>
    </ion-slide-page>
  </ion-slides>

</body>

</html>
              
            
!

CSS

              
                .box {
  height: 100%;
}

ion-slides {
  height: 100vh !important;
}

.bgColor_0 {
  background-color: #cc2244;
}

.bgColor_1 {
  background-color: #cc6622;
}

.bgColor_2 {
  background-color: #cccc22;
}

.bgColor_3 {
  background-color: #66cc22;
}

.bgColor_4 {
  background-color: #22cc44;
}

.bgColor_5 {
  background-color: #22ccaa;
}

.bgColor_6 {
  background-color: #2288cc;
}

.bgColor_7 {
  background-color: #2222cc;
}

.bgColor_8 {
  background-color: #8822cc;
}

.bgColor_9 {
  background-color: #cc22aa;
}

              
            
!

JS

              
                angular.module('ionicApp', ['ionic'])

.controller('Ctrl', function($scope) {
  $scope.data = {};
  $scope.data.bgColors = [];
  $scope.data.currentPage = 0;

  for (var i = 0; i < 10; i++) {
    $scope.data.bgColors.push("bgColor_" + i);
  }

  var setupSlider = function() {
    //some options to pass to our slider
    $scope.data.sliderOptions = {
      initialSlide: 0,
      direction: 'horizontal', //or vertical
      speed: 300, //0.3s transition
      pagination: false
    };

    //create delegate reference to link with slider
    $scope.data.sliderDelegate = null;

    //watch our sliderDelegate reference, and use it when it becomes available
    $scope.$watch('data.sliderDelegate', function(newVal, oldVal) {
      if (newVal != null) {
        $scope.data.sliderDelegate.on('slideChangeEnd', function() {
          $scope.data.currentPage = $scope.data.sliderDelegate.activeIndex;
          //use $scope.$apply() to refresh any content external to the slider
          $scope.$apply();
        });
      }
    });
  };

  setupSlider();
  
  $scope.slidePrevious = function() {

    }

    $scope.slideNext = function() {

    }
})
              
            
!
999px

Console