return this.queue(function() {
// Create element
- var el = $(this), props = ['position','top','bottom','left','right','height','width'];
-
- // Set options
- var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
- var direction = o.options.direction || 'vertical'; // Default direction
+ var el = $( this ),
+ props = ['position','top','bottom','left','right','height','width'],
+ mode = $.effects.setMode( el, o.mode || 'hide' ),
+ direction = o.direction || 'vertical'; // Default direction
// Adjust
$.effects.save(el, props); el.show(); // Save & Show
animation[ref.position] = mode == 'show' ? 0 : distance / 2;
// Animate
- animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
+ animate.animate(animation, { queue: false, duration: o.duration, easing: o.easing, complete: function() {
if(mode == 'hide') el.hide(); // Hide
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
- if(o.callback) o.callback.apply(el[0], arguments); // Callback
+ if(o.complete) o.complete.apply(el[0], arguments); // Callback
el.dequeue();
}});
return this.queue(function() {
// Create element
- var el = $(this), props = ['position','top','bottom','left','right','opacity'];
-
- // Set options
- var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
- var direction = o.options.direction || 'left'; // Default Direction
+ var el = $( this ),
+ props = ['position','top','bottom','left','right','opacity'],
+ mode = $.effects.setMode(el, o.mode || 'hide'),
+ direction = o.direction || 'left'; // Default Direction
// Adjust
$.effects.save(el, props); el.show(); // Save & Show
$.effects.createWrapper(el); // Create Wrapper
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
- var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
+ var distance = o.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
// Animation
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
// Animate
- el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
+ el.animate(animation, { queue: false, duration: o.duration, easing: o.easing, complete: function() {
if(mode == 'hide') el.hide(); // Hide
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
- if(o.callback) o.callback.apply(this, arguments); // Callback
+ if(o.complete) o.complete.apply(this, arguments); // Callback
el.dequeue();
}});
return this.queue(function() {
- var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
- var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
+ var rows = o.pieces ? Math.round(Math.sqrt(o.pieces)) : 3;
+ var cells = o.pieces ? Math.round(Math.sqrt(o.pieces)) : 3;
- o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
+ o.mode = o.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.mode;
var el = $(this).show().css('visibility', 'hidden');
var offset = el.offset();
overflow: 'hidden',
width: width/cells,
height: height/rows,
- left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
- top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
- opacity: o.options.mode == 'show' ? 0 : 1
+ left: offset.left + j*(width/cells) + (o.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
+ top: offset.top + i*(height/rows) + (o.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
+ opacity: o.mode == 'show' ? 0 : 1
}).animate({
- left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
- top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
- opacity: o.options.mode == 'show' ? 1 : 0
+ left: offset.left + j*(width/cells) + (o.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
+ top: offset.top + i*(height/rows) + (o.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
+ opacity: o.mode == 'show' ? 1 : 0
}, o.duration || 500);
}
}
// Set a timeout, to call the callback approx. when the other animations have finished
setTimeout(function() {
- o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
- if(o.callback) o.callback.apply(el[0]); // Callback
+ o.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
+ if(o.complete) o.complete.apply(el[0]); // Callback
el.dequeue();
$('div.ui-effects-explode').remove();
var el = $(this), props = ['position','top','bottom','left','right'];
// Set options
- var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
- var size = o.options.size || 15; // Default fold size
- var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
+ var mode = $.effects.setMode(el, o.mode || 'hide'); // Set Mode
+ var size = o.size || 15; // Default fold size
+ var horizFirst = !(!o.horizFirst); // Ensure a boolean value
var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
// Adjust
animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
// Animate
- wrapper.animate(animation1, duration, o.options.easing)
- .animate(animation2, duration, o.options.easing, function() {
+ wrapper.animate(animation1, duration, o.easing)
+ .animate(animation2, duration, o.easing, function() {
if(mode == 'hide') el.hide(); // Hide
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
- if(o.callback) o.callback.apply(el[0], arguments); // Callback
+ if(o.complete) o.complete.apply(el[0], arguments); // Callback
el.dequeue();
});
return this.queue(function() {
var elem = $(this),
props = ['backgroundImage', 'backgroundColor', 'opacity'],
- mode = $.effects.setMode(elem, o.options.mode || 'show'),
+ mode = $.effects.setMode(elem, o.mode || 'show'),
animation = {
backgroundColor: elem.css('backgroundColor')
};
.show()
.css({
backgroundImage: 'none',
- backgroundColor: o.options.color || '#ffff99'
+ backgroundColor: o.color || '#ffff99'
})
.animate(animation, {
queue: false,
duration: o.duration,
- easing: o.options.easing,
+ easing: o.easing,
complete: function() {
(mode == 'hide' && elem.hide());
$.effects.restore(elem, props);
(mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));
- (o.callback && o.callback.apply(this, arguments));
+ (o.complete && o.complete.apply(this, arguments));
elem.dequeue();
}
});
$.effects.pulsate = function(o) {
return this.queue(function() {
var elem = $(this),
- mode = $.effects.setMode(elem, o.options.mode || 'show'),
- times = ((o.options.times || 5) * 2) - 1,
+ mode = $.effects.setMode(elem, o.mode || 'show'),
+ times = ((o.times || 5) * 2) - 1,
duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2,
isVisible = elem.is(':visible'),
animateTo = 0;
}
for (var i = 0; i < times; i++) {
- elem.animate({ opacity: animateTo }, duration, o.options.easing);
+ elem.animate({ opacity: animateTo }, duration, o.easing);
animateTo = (animateTo + 1) % 2;
}
- elem.animate({ opacity: animateTo }, duration, o.options.easing, function() {
+ elem.animate({ opacity: animateTo }, duration, o.easing, function() {
if (animateTo == 0) {
elem.hide();
}
- (o.callback && o.callback.apply(this, arguments));
+ (o.complete && o.complete.apply(this, arguments));
});
elem
var el = $(this), props = ['position','top','bottom','left','right'];
// Set options
- var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
- var direction = o.options.direction || 'left'; // Default direction
- var distance = o.options.distance || 20; // Default distance
- var times = o.options.times || 3; // Default # of times
- var speed = o.duration || o.options.duration || 140; // Default speed per shake
+ var mode = $.effects.setMode(el, o.mode || 'effect'); // Set Mode
+ var direction = o.direction || 'left'; // Default direction
+ var distance = o.distance || 20; // Default distance
+ var times = o.times || 3; // Default # of times
+ var speed = o.duration || o.duration || 140; // Default speed per shake
// Adjust
$.effects.save(el, props); el.show(); // Save & Show
animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
// Animate
- el.animate(animation, speed, o.options.easing);
+ el.animate(animation, speed, o.easing);
for (var i = 1; i < times; i++) { // Shakes
- el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);
+ el.animate(animation1, speed, o.easing).animate(animation2, speed, o.easing);
};
- el.animate(animation1, speed, o.options.easing).
- animate(animation, speed / 2, o.options.easing, function(){ // Last shake
+ el.animate(animation1, speed, o.easing).
+ animate(animation, speed / 2, o.easing, function(){ // Last shake
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
- if(o.callback) o.callback.apply(this, arguments); // Callback
+ if(o.complete) o.complete.apply(this, arguments); // Callback
});
el.queue('fx', function() { el.dequeue(); });
el.dequeue();
var el = $(this), props = ['position','top','bottom','left','right'];
// Set options
- var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
- var direction = o.options.direction || 'left'; // Default Direction
+ var mode = $.effects.setMode(el, o.mode || 'show'); // Set Mode
+ var direction = o.direction || 'left'; // Default Direction
// Adjust
$.effects.save(el, props); el.show(); // Save & Show
$.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
- var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
+ var distance = o.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance); // Shift
// Animation
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
// Animate
- el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
+ el.animate(animation, { queue: false, duration: o.duration, easing: o.easing, complete: function() {
if(mode == 'hide') el.hide(); // Hide
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
- if(o.callback) o.callback.apply(this, arguments); // Callback
+ if(o.complete) o.complete.apply(this, arguments); // Callback
el.dequeue();
}});
$.effects.transfer = function(o) {
return this.queue(function() {
var elem = $(this),
- target = $(o.options.to),
+ target = $(o.to),
endPosition = target.offset(),
animation = {
top: endPosition.top,
startPosition = elem.offset(),
transfer = $('<div class="ui-effects-transfer"></div>')
.appendTo(document.body)
- .addClass(o.options.className)
+ .addClass(o.className)
.css({
top: startPosition.top,
left: startPosition.left,
width: elem.innerWidth(),
position: 'absolute'
})
- .animate(animation, o.duration, o.options.easing, function() {
+ .animate(animation, o.duration, o.easing, function() {
transfer.remove();
- (o.callback && o.callback.apply(elem[0], arguments));
+ (o.complete && o.complete.apply(elem[0], arguments));
elem.dequeue();
});
});