css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    
    <title>Google Now Style Card Animations</title>

    <link href="//code.ionicframework.com/1.0.0-beta.13/css/ionic.css" rel="stylesheet">
    <script src="//code.ionicframework.com/1.0.0-beta.13/js/ionic.bundle.js"></script>
    <script src="https://rawgit.com/mixersoft/ionic-contrib-swipe-cards/master/ionic.swipecards.js"></script>
    
  </head>
<body ng-app="starter" no-scroll>

  <ion-content ng-controller="CardsCtrl">
    <ion-header-bar align-title="center" class="bar-positive">
      <h1 class="title">Google Now Style Cards</h1>
    </ion-header-bar>

    <div class="list has-header">
<!-- NOTE: directive: collection-repeat requires directive:swipe-card to be applied as an Attribute to avoid clash -->      
<swipe-cards 
     collection-repeat="card in cards"
     collection-item-width="'100%'"
     collection-item-height="320"     
     >
      
      <swipe-card fly="back"
      on-keep="cardKeep(card)" 
      on-reject="cardReject(card)" 
      on-card-swipe="cardSwiped($index)"
      ng-class="{keep:card.keep, reject:card.keep!=null}"
      >
          <ng-include src="'tossable-card.html'"
          ng-controller="CardCtrl"></ng-include>
      </swipe-card>
</swipe-cards>
    </div>
  </ion-content>



<script id="tossable-card.html" type="text/ng-template">
  <div class="card tossable-card">
      <div class="item item-divider item-positive">
       {{card.title}}
      </div>  
      <div class="item item-image">
        <img ng-src="http://lorempixel.com/320/240?{{$index}}">
      </div>
      <div class="item item-divider item-positive text-right">
        {{$index}}
      </div> 
   </div>
</script>

</body>
</html>
            
          
!
            
              /* Your app's CSS, go crazy, make it your own */

.ionic-logo {
  display: block;
  margin: 15px auto;
  width: 96px;
  height: 96px;
}

.pane , ion-content {
  background-color: #333;
}

.bar.bar-transparent {
  background-color: transparent;
  background-image: none;
  border: none;
}

.bar .title {
  color: #eee;
}

.swipe-cards {
  width:100%;
}


#start-card {
  color: #fff;
  background-color: #30BD8A;
  line-height: 300px;
  word-wrap: break-word;
  border: 6px solid #4CD68E;
  text-align: center;
}
#start-card span {
  display: inline-block;
  line-height: 40px;
  width: 200px;
  font-size: 30px;
  vertical-align: middle;
}

#footer .button {
  color: #fff;
}

@-webkit-keyframes bounceIn {
  0% {
    -webkit-transform: scale(0,0);
  }
  70% {
    -webkit-transform: scale(1.2,1.2);
  }
  100% {
    -webkit-transform: scale(1,1);
  }
}

.swipe-card.pop-in-start {
  -webkit-transform: scale(0,0);
}
.swipe-card.pop-in {
  -webkit-animation: bounceIn 0.4s ease-out;
}


.card.tossable-card {
  width: 320px;
  margin: 4px auto;
}

.swipe-card.keep .tossable-card .item.item-divider {
  background-color: lightgreen !important;
}
.swipe-card.reject .tossable-card .item.item-divider {
  background-color: darkred !important;
}
.swipe-card.reject .tossable-card .item.item-image {
  background-color: black;
}
.swipe-card.reject .tossable-card .item.item-image > img {
  opacity: 0.5;
}

            
          
!
            
              // https://codepen.io/anon/pen/ZYzPOY

// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
angular.module('starter', ['ionic', 'ionic.contrib.ui.cards'])
.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if (window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if (window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
})

.directive('noScroll', function($document) {

  return {
    restrict: 'A',
    link: function($scope, $element, $attr) {

      $document.on('touchmove', function(e) {
        e.preventDefault();
      });
    }
  }
})


.controller('CardsCtrl', function($scope, $ionicSwipeCardDelegate) {
  var cardTypes = [{
    title: 'Swipe down to clear the card',
    image: 'img/pic.png'
  }, {
    title: 'Where is this?',
    image: 'img/pic.png'
  }, {
    title: 'What kind of grass is this?',
    image: 'img/pic2.png'
  }, {
    title: 'What beach is this?',
    image: 'img/pic3.png'
  }, {
    title: 'What kind of clouds are these?',
    image: 'img/pic4.png'
  }];

  $scope.cards = Array.prototype.slice.call(cardTypes, 0, 0);

  $scope.cards = [
    {title: "Doubts In The Name Of Love"},
    {title: "Plans On My Mind"},
    {title: "Overt Loser"},
    {title: "Hands Off My Heat"},
    {title: "My Wooden Anarchy"},
    {title: "Doubts In The Name Of Love"},
    {title: "Plans On My Mind"},
    {title: "Overt Loser"},
    {title: "Hands Off My Heat"},
    {title: "My Wooden Anarchy"},
    {title: "Doubts In The Name Of Love"},
    {title: "Plans On My Mind"},
    {title: "Overt Loser"},
    {title: "Hands Off My Heat"},
    {title: "My Wooden Anarchy"},
    {title: "Doubts In The Name Of Love"},
    {title: "Plans On My Mind"},
    {title: "Overt Loser"},
    {title: "Hands Off My Heat"},
    {title: "My Wooden Anarchy"},
    {title: "Mystic Tuxedo"}
  ];
  

  $scope.cardSwiped = function(index) {
    // $scope.addCard();
  };

  $scope.cardDestroyed = function(index) {
    // $scope.cards.splice(index, 1);
  };

  $scope.cardReject = function(card) {
    card.keep=false
    console.log('cardReject, title='+card.title)

  };

  $scope.cardKeep = function(card) {
    card.keep=true
    console.log('cardReject, title='+card.title)
  };

  $scope.addCard = function() {
    var newCard = cardTypes[Math.floor(Math.random() * cardTypes.length)];
    newCard.id = Math.random();
    $scope.cards.push(angular.extend({}, newCard));
  }
})

.controller('CardCtrl', function($scope, $ionicSwipeCardDelegate) {
  $scope.goAway = function() {
    var card = $ionicSwipeCardDelegate.getSwipebleCard($scope);
    card.swipe();
  };
});

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console