GithubHelp home page GithubHelp logo

kloy / gq Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 132 KB

Javascript library for moving with elegance (CSS transitions).

License: MIT License

JavaScript 97.45% CSS 2.55%

gq's Introduction

GQ.

Warning Library is still a WIP. Javascript library for moving with elegance (CSS transitions).

GQ was created to provide an easier way of creating programmatic CSS 3 transitions without any dependencies on jQuery or other libraries. Unlike other transition plugins/libraries, GQ allows for applying transitions using css styles and css classes.

Example

var complete = function (iGQ) {

	iGQ.
		removeClass('in').
		removeClass('fade');
};

var el = document.getElementById('foo');
var iGQ = GQ(el);
iGQ.
	addClass('fade').
	when('transitionend', complete).
	when('cancel', complete).
	transition(function (iGQ) {
		iGQ.
			redraw().
			addClass('in');
	});

if (iGQ.isTransitioning()) {
	iGQ.cancel();
}

Public API

All publically available methods/properties are explained in this section. Methods/properties are available on object returned from gq(element).

element

Element passed to gq().

addClass( cssClass )

Add css class to element.

removeClass( cssClass )

Remove css class from element.

hasClass( cssClass )

Check if css class exists on element.

style( property, [value] )

When passed with 1st argument only, get computed style property. When passed with both arguments, set style property to value.

redraw()

Forces a dom redraw. Useful for ensuring css properties get changed and not batched.

transition( function )

Wrapper for applying styles or classes to apply a transition. Automatically hooks up transitionend event listener as well as a timeout in case transitionend does not get fired.

isTransitioning()

Way to check if GQ instance is currently transitioning. Useful for check before calling cancel().

cancel()

Cancel current transition and trigger "cancel" event.

when( eventName, function )

Executes registered functions when event is triggered. Events available are...

  • transitionend
  • cancel

gq's People

Stargazers

 avatar  avatar

Watchers

 avatar  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.