Skip to content

A directive to simulate a card with flipping and zooming in ability as seen in Google now cards

License

Notifications You must be signed in to change notification settings

souly1/angular-flip-card

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

angular-flip-card

The Card is one of the most lovable and fashionable UX element out at the moment. It is great and intuitive as it brings physical objects we are familiar with into the digital world. As a card, one of the basic abilities is to flip it as can be seen in Google now cards.

Since We required such and ability for our Fitness Meal Planner webApp with multiple cards on screen and needs to be responsive UI, I created this Angular directive which is an implementation to resemble that behaviour.

Demo

Demo can be seen here

Requirements

  • AngularJS
  • No need for JQuery as JQLite is used

Notes

This directive has been originally developed for the Ionic Framework, so it supports both angular and ionic apps.

Installation

  • Bower: bower install angular-flip-card

Usage

Load the script files in your application:

<script type="text/javascript" src="wherever-you-put-it/fmpCardDirective.js"></script>

Add dependencies on the fmp-card AngularJS module:

angular.module('myModule', ['fmp-card']);

You can now use the directive, just add the element to your HTML:

<fmp-card>
  ...
</fmp-card>

Where you can replace any HTML code as you like instead of the three dotes as this uses the Angular transclude ability. This represents the cards back side

Usage Example

<fmp-card suffix="1" image="card-front-icon.png" front-caption="Hello card front" small-card-height="100px" small-card-width="200px">
    This is the back of the card!
</fmp-card>

Directive Options

  • small-card-width (optional) - the width of the small card. Can be defined with percentage. Card turned will be twice this size. Defaults auto
  • small-card-height (optional) - the height of the small card. Can be defined with percentage. Card turned will be twice this size. Defaults to 100%
  • suffix (optional) - a suffix to be added to id's for the small card and large card representations. Prefix is 'fmp-card-small-'/'fmp-card-large-' representatively. If none supplied random number issued
  • image (optional) - image to be used as cards front face background
  • front-caption (optional) - The caption to show for the front cards face
  • onCardOpened (optional) - bind an event fired when card is pressed to open.
  • onCardClosed (optional) - bind an event fired when card is pressed to be closed. if Returns false then cancels close of card
  • cardControl (optional) - given object will receive to methods, one to open card and one to close. both have transition time parameter defining in what speed to perform card flip flipToLarge - Method that will flip small card to large representation flipToSmall - Method that will flip large card to large representation

Testing

Ran on Chrome, Safari, Iphone 4 Emulator and Android S3, For continuous integration with Karma with Jasmine, run on Travis CI for FireFox

License

As AngularJS itself, this module is released under the permissive MIT license. Your contributions are always welcome.

About

A directive to simulate a card with flipping and zooming in ability as seen in Google now cards

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published