Coder Social home page Coder Social logo

flippant.js's Introduction

Demonstrations:

Are over here: http://mintchaos.github.io/flippant.js/

Whys and hows:

  • Flippant is tiny. It does just enough and no more. It has zero dependencies.
  • Flippant is easily customized. A couple of arguments, and CSS.
  • Flippant has a single function: flippant.flip. Use it to flip things!
var front = document.getElementById('flipthis')
  , back_content = "<h1>I'm the back!</h1>" // Generate or pull any HTML you want for the back.
  , back

// when the correct action happens, call flip!
back = flippant.flip(front, back_content)
// this creates the back element, sizes it and flips it around.

// call the close method on the back element when it's time to close.
back.close()
// alternatively you can trigger a close event on the back element if you fancy.
var close_event = new CustomEvent('close')
back.dispatchEvent(close_event)

Two modes: card (the default), and modal.

back = flippant.flip(front, back_content, 'modal')

The back gets the default class of flippant-modal-dark for modal flips and flippant-modal-light for cards. These styles can be overriden or you can pass in your own class.

back = flippant.flip(front, back_content, 'modal', 'my-modal-classname')

The full API:

flip(element_to_flip, content_for_back, type(modal/card), classname_for_back) -> back_element

74.3% of the magic is in the css file. Override however you'd like.

“Installation”

Grab the JS and the CSS file. Use them. The JS file is a UMD package so require or commonjs it or just use it. It's not picky.

flippant.js's People

Contributors

blturner avatar git-richard avatar mintchaos avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.