Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added new effect splitSlide

  • Loading branch information...
commit 1fb934fe04965584547cae3489874f550d282684 1 parent ff3ff99
Henning Huncke authored
View
101 javascripts/jquery.simpleSlider.effects.js
@@ -1,7 +1,7 @@
/**
* effects for simpleSlider
*
- * @version: 1.4.18 - (2012/04/10)
+ * @version: 1.4.19 - (2012/04/10)
* @author Henning Huncke
*
* Copyright (c) 2011-2012 Henning Huncke (http://www.devjunkie.de)
@@ -54,6 +54,12 @@
);
};
+ $.simpleSlider.stepMethodBackgroundPosition = function (now, fx) {
+ if (fx.prop == 'backgroundPosition' || fx.prop == 'background-position') {
+ $.simpleSlider.animateBackgroundPosition(fx);
+ }
+ };
+
// method to parse the given background-position value on animate
$.simpleSlider.parseBackgroundPosition = function (value) {
var position = value.split(/ /);
@@ -346,11 +352,7 @@
'backgroundPosition': backgroundPosition
}, {
duration: options.speed / speedModifier,
- step: function (now, fx) {
- if (fx.prop == 'backgroundPosition' || fx.prop == 'background-position') {
- $.simpleSlider.animateBackgroundPosition(fx);
- }
- },
+ step: $.simpleSlider.stepMethodBackgroundPosition,
complete: callback
});
@@ -450,11 +452,7 @@
'backgroundPosition': backgroundPosition
}, {
duration: options.speed / speedModifier,
- step: function (now, fx) {
- if (fx.prop == 'backgroundPosition' || fx.prop == 'background-position') {
- $.simpleSlider.animateBackgroundPosition(fx);
- }
- },
+ step: $.simpleSlider.stepMethodBackgroundPosition,
complete: callback
});
});
@@ -479,6 +477,75 @@
}
);
+ // split slide
+ $.simpleSlider.addEffect('splitSlide',
+ function (current, next, opts) {
+ var options = $.extend({}, this.getOptions(), opts, {squaresPerHeight: 2, squaresPerWidth: 2});
+ var self = this;
+ var marginH = parseInt(current.css('height'));
+ var marginW = parseInt(current.css('width'));
+
+ next.css({
+ 'top': 0,
+ 'left': 0,
+ 'z-index': options.zIndex + 90
+ }).show();
+ current.css('z-index', options.zIndex + 100);
+
+ var dimension = $.simpleSlider.buildSquareMatrix(current, options);
+
+ $('img:first', current).hide();
+ $('div:[id*="simpleSlider-square"]', current).show();
+ $('div:[id="simpleSlider-square-1-1"]', current).animate({
+ 'height': 0,
+ 'width': 0
+ }, {
+ duration: options.speed,
+ complete: function () {
+ $('div:[id*="simpleSlider-square-"]', current).remove();
+ }
+ });
+ $('div:[id="simpleSlider-square-1-2"]', current).animate({
+ 'height': 0,
+ 'width': 0,
+ 'margin-left': marginW / 2,
+ 'backgroundPosition': '-' + marginW + 'px 0px'
+ }, {
+ duration: options.speed,
+ step: $.simpleSlider.stepMethodBackgroundPosition,
+ complete: function () {
+ $('div:[id*="simpleSlider-square-"]', current).remove();
+ }
+ });
+ $('div:[id="simpleSlider-square-2-1"]', current).animate({
+ 'height': 0,
+ 'width': 0,
+ 'margin-top': marginH / 2,
+ 'backgroundPosition': '0px -' + marginH + 'px'
+ }, {
+ duration: options.speed,
+ step: $.simpleSlider.stepMethodBackgroundPosition,
+ complete: function () {
+ $('div:[id*="simpleSlider-square-"]', current).remove();
+ self.complete();
+ }
+ });
+ $('div:[id="simpleSlider-square-2-2"]', current).animate({
+ 'height': 0,
+ 'width': 0,
+ 'margin-top': marginH / 2,
+ 'margin-left': marginW / 2,
+ 'backgroundPosition': '-' + marginW + 'px -' + marginH + 'px'
+ }, {
+ duration: options.speed,
+ step: $.simpleSlider.stepMethodBackgroundPosition,
+ complete: function () {
+ $('div:[id*="simpleSlider-square-"]', current).remove();
+ }
+ });
+ }
+ );
+
// split slide horizontal
$.simpleSlider.addEffect('splitSlideHorizontal',
function (current, next, opts) {
@@ -511,11 +578,7 @@
'backgroundPosition': '-' + margin + 'px 0px'
}, {
duration: options.speed,
- step: function (now, fx) {
- if (fx.prop == 'backgroundPosition' || fx.prop == 'background-position') {
- $.simpleSlider.animateBackgroundPosition(fx);
- }
- },
+ step: $.simpleSlider.stepMethodBackgroundPosition,
complete: function () {
$('div:[id*="simpleSlider-square-"]', current).remove();
self.complete();
@@ -556,11 +619,7 @@
'backgroundPosition': '0px -' + margin + 'px'
}, {
duration: options.speed,
- step: function (now, fx) {
- if (fx.prop == 'backgroundPosition' || fx.prop == 'background-position') {
- $.simpleSlider.animateBackgroundPosition(fx);
- }
- },
+ step: $.simpleSlider.stepMethodBackgroundPosition,
complete: function () {
$('div:[id*="simpleSlider-square-"]', current).remove();
self.complete();
View
4 javascripts/jquery.simpleSlider.js
@@ -1,7 +1,7 @@
/**
* simpleSlider - jQuery plugin
*
- * @version: 1.4.18 - (2012/04/10)
+ * @version: 1.4.19 - (2012/04/10)
* @author Henning Huncke
*
* Copyright (c) 2011-2012 Henning Huncke (http://www.devjunkie.de)
@@ -18,7 +18,7 @@
* static constructs
********************************************************************************/
$.simpleSlider = {
- version: '1.4.18',
+ version: '1.4.19',
addEffect: function (name, fn) {
effects[name] = fn;
Please sign in to comment.
Something went wrong with that request. Please try again.