Permalink
Browse files

Add fx engine extention

1 parent 5cdca1b commit e0d361f7494340d758f454d00bc739dfc830c1ab @nicinabox committed Jul 9, 2013
Showing with 66 additions and 1 deletion.
  1. +13 −0 README.md
  2. +47 −0 examples/custom-fx.html
  3. +2 −1 examples/index.html
  4. +2 −0 src/fx.js
  5. +2 −0 src/plugin.js
View
@@ -162,6 +162,19 @@ You could even use a UL as the `slides-container`
</div>
```
+## Custom Animations
+
+I realize that you might want to do something unique in your application. That's why I've added the ability to extend the existing animations with your own. See `examples/custom-fx.html`.
+
+```javascript
+$.fn.superslides.fx = $.extend({
+ flip: function(orientation, complete) {
+ console.log(orientation);
+ complete();
+ }
+}, $.fn.superslides.fx);
+```
+
## Hardware Acceleration
Superslides is compatible with the [jQuery Animate Enhanced](http://playground.benbarnett.net/jquery-animate-enhanced/) plugin. Simply include it before this plugin and it will automatically smooth out transitions using CSS instead of JavaScript.
View
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Superslides - A fullscreen slider for jQuery</title>
+ <link rel="stylesheet" href="../dist/stylesheets/superslides.css">
+</head>
+<body>
+ <div id="slides">
+ <div class="slides-container">
+ <img src="images/people.jpeg" alt="Cinelli">
+ <img src="images/surly.jpeg" width="1024" height="682" alt="Surly">
+ <img src="images/cinelli-front.jpeg" width="1024" height="683" alt="Cinelli">
+ <img src="images/affinity.jpeg" width="1024" height="685" alt="Affinity">
+ </div>
+
+ <nav class="slides-navigation">
+ <a href="#" class="next">Next</a>
+ <a href="#" class="prev">Previous</a>
+ </nav>
+ </div>
+
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
+ <script src="javascripts/jquery.easing.1.3.js"></script>
+ <script src="javascripts/jquery.animate-enhanced.min.js"></script>
+ <script src="../dist/jquery.superslides.js" type="text/javascript" charset="utf-8"></script>
+ <script>
+ $(function() {
+ // This animation doesn't do anything, but it
+ // demonstrates how to create a custom effect.
+ // See src/fx.js for full example on creating
+ // a custom effect.
+ $.fn.superslides.fx = $.extend({
+ flip: function(orientation, complete) {
+ console.log(orientation);
+ complete();
+ }
+ }, $.fn.superslides.fx);
+
+ $('#slides').superslides({
+ hashchange: true,
+ animation: 'flip'
+ });
+ });
+ </script>
+</body>
+</html>
View
@@ -13,8 +13,9 @@
<li><a href="play.html">Play</a></li>
<li><a href="multiple.html">Multiple</a></li>
<li><a href="custom-pagination.html">Custom Pagination</a></li>
+ <li><a href="custom-fx.html">Custom Animation</a></li>
<li><a href="touch.html">Touch Enabled</a></li>
- <li><a href="preserved-images.html">Preserved images</a></li>
+ <li><a href="preserved-images.html">Preserved Images</a></li>
</ul>
</body>
</html>
View
@@ -79,3 +79,5 @@ var fx = {
}
}
};
+
+fx = $.extend(fx, $.fn.superslides.fx);
View
@@ -24,3 +24,5 @@ $.fn[plugin] = function(option, args) {
return result;
};
+
+$.fn[plugin].fx = {};

0 comments on commit e0d361f

Please sign in to comment.