Skip to content

Commit

Permalink
Merge pull request #68 from nnattawat/add-namespace
Browse files Browse the repository at this point in the history
Add namespace to flip events
  • Loading branch information
nnattawat committed Jan 8, 2016
2 parents 3dfb478 + 0018251 commit 7eee1ad
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 78 deletions.
115 changes: 59 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,66 @@
**A lightweight jQuery plugin to create 3d flip animation.**
See the [project page](http://nnattawat.github.io/flip/)

## Getting Started

### CDN
https://cdn.rawgit.com/nnattawat/flip/v1.0.19/dist/jquery.flip.min.js

### Download
* [jquery.flip.js][max] (development version, commented ~9kB)
* [jquery.flip.min.js][min] (production version, minified ~4kB, gzipped ~2kB)
* [jquery.flip.min.js.map][map] (source map, ~5kB)
[max]: https://cdn.rawgit.com/nnattawat/flip/v1.0.19/dist/jquery.flip.js
[min]: https://cdn.rawgit.com/nnattawat/flip/v1.0.19/dist/jquery.flip.min.js
[map]: https://cdn.rawgit.com/nnattawat/flip/v1.0.19/dist/jquery.flip.min.js.map

### Bower
<pre>bower install flip</pre>

### Usage
In your web page:

```html

<div id="card">
<div class="front">
Front content
</div>
<div class="back">
Back content
</div>
</div>

<script src="jquery.js"></script>
<script src="jquery.flip.js"></script>
<script>
$(function($) {
$("#card").flip();
});
</script>
```

## Documentation and Example

Please refer to [the project website](http://nnattawat.github.io/flip/)

## Development
Ensure that you have the latest [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/) installed.

Test that Grunt's CLI and Bower are installed by running `grunt --version` and `bower --version`. If the commands aren't found, run `npm install -g grunt-cli bower`. For more information about installing the tools, see the [getting started with Grunt guide](http://gruntjs.com/getting-started) or [bower.io](http://bower.io/) respectively.

To run the demo locally, do the following.
<pre>
npm install
bower install
</pre>

And run grunt command to create files in /dist folder.
<pre>grunt</pre>

## What's new
* **Flip v1.0.19**
* [Add `.flap` namespace to all flip events](https://github.com/nnattawat/flip/commit/b75660b)
* **Flip v1.0.18**
* Fixed [Missing comma in package.json #64](https://github.com/nnattawat/flip/issues/64)
* Thanks to [Zlatko Fedor](https://github.com/seeden) for reporting and fixing this!
Expand Down Expand Up @@ -61,59 +120,3 @@ See the [project page](http://nnattawat.github.io/flip/)
* **Flip v1.0.2 - v1.0.5**
Chaotic period of development culminating in v1.0.6 see above.

## Getting Started

### CDN
https://cdn.rawgit.com/nnattawat/flip/v1.0.18/dist/jquery.flip.min.js

### Download
* [jquery.flip.js][max] (development version, commented ~9kB)
* [jquery.flip.min.js][min] (production version, minified ~4kB, gzipped ~2kB)
* [jquery.flip.min.js.map][map] (source map, ~5kB)
[max]: https://cdn.rawgit.com/nnattawat/flip/v1.0.18/dist/jquery.flip.js
[min]: https://cdn.rawgit.com/nnattawat/flip/v1.0.18/dist/jquery.flip.min.js
[map]: https://cdn.rawgit.com/nnattawat/flip/v1.0.18/dist/jquery.flip.min.js.map

### Bower
<pre>bower install flip</pre>

### Usage
In your web page:

```html

<div id="card">
<div class="front">
Front content
</div>
<div class="back">
Back content
</div>
</div>

<script src="jquery.js"></script>
<script src="jquery.flip.js"></script>
<script>
$(function($) {
$("#card").flip();
});
</script>
```

## Documentation and Example

Please refer to [the project website](http://nnattawat.github.io/flip/)

## Development
Ensure that you have the latest [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/) installed.

Test that Grunt's CLI and Bower are installed by running `grunt --version` and `bower --version`. If the commands aren't found, run `npm install -g grunt-cli bower`. For more information about installing the tools, see the [getting started with Grunt guide](http://gruntjs.com/getting-started) or [bower.io](http://bower.io/) respectively.

To run the demo locally, do the following.
<pre>
npm install
bower install
</pre>

And run grunt command to create files in /dist folder.
<pre>grunt</pre>
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flip",
"version": "1.0.18",
"version": "1.0.19",
"dependencies": {
"jquery": "~2.0"
},
Expand Down
18 changes: 9 additions & 9 deletions dist/jquery.flip.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*! flip - v1.0.18 - 2015-11-12
/*! flip - v1.0.19 - 2016-01-04
* https://github.com/nnattawat/flip
* Copyright (c) 2015 Nattawat Nonsung; Licensed MIT */
* Copyright (c) 2016 Nattawat Nonsung; Licensed MIT */
(function( $ ) {
var flip = function($dom, callback) {
$dom.data("flipped", true);
Expand Down Expand Up @@ -155,7 +155,7 @@
// Back face always visible on Chrome #39
if ((window.chrome || (window.Intl && Intl.v8BreakIterator)) && 'CSS' in window){
//Blink Engine, add preserve-3d to $dom
$dom.css({"-webkit-transform-style": "preserve-3d"});
$dom.css({"-webkit-transform-style": "preserve-3d"});
}
// /#39

Expand All @@ -178,7 +178,7 @@
}, 20);

if (settings.trigger.toLowerCase() == "click") {
$dom.on($.fn.tap ? "tap" : "click", function(event) {
$dom.on($.fn.tap ? "tap.flip" : "click.flip", function(event) {
if (!event) {event = window.event;}
if ($dom.find($(event.target).closest('button, a, input[type="submit"]')).length) {
return;
Expand All @@ -193,12 +193,12 @@
}
else if (settings.trigger.toLowerCase() == "hover") {
var performFlip = function() {
$dom.unbind('mouseleave', performUnflip);
$dom.off('mouseleave.flip');

flip($dom);

setTimeout(function() {
$dom.bind('mouseleave', performUnflip);
$dom.on('mouseleave.flip', performUnflip);
if (!$dom.is(":hover")) {
unflip($dom);
}
Expand All @@ -209,8 +209,8 @@
unflip($dom);
};

$dom.mouseenter(performFlip);
$dom.mouseleave(performUnflip);
$dom.on('mouseenter.flip', performFlip);
$dom.on('mouseleave.flip', performUnflip);
}
}else{
//The element has been initiated, all we have to do is change applicable settings
Expand Down Expand Up @@ -273,4 +273,4 @@
setTimeout(callback.bind(this), 0);
}
};
}( jQuery ));
}( jQuery ));
6 changes: 3 additions & 3 deletions dist/jquery.flip.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7eee1ad

Please sign in to comment.