forked from malsup/cycle2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.cycle2.ie-fade.js
46 lines (41 loc) · 1.44 KB
/
jquery.cycle2.ie-fade.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*! ie-fade transition plugin for Cycle2; version: 20121120 */
(function($) {
"use strict";
function cleartype(before, opts, el) {
if ( before && el.style.filter ) {
opts._filter = el.style.filter;
try { el.style.removeAttribute('filter'); }
catch(smother) {} // handle old opera versions
}
else if ( !before && opts._filter ) {
el.style.filter = opts._filter;
}
}
$.extend($.fn.cycle.transitions, {
fade: {
before: function( opts, curr, next, fwd ) {
var css = opts.API.getSlideOpts( opts.nextSlide ).slideCss || {};
opts.API.stackSlides( curr, next, fwd );
opts.cssBefore = $.extend(css, { opacity: 0, display: 'block' });
opts.animIn = { opacity: 1 };
opts.animOut = { opacity: 0 };
cleartype( true, opts, next );
},
after: function( opts, curr, next ) {
cleartype( false, opts, next );
}
},
fadeout: {
before: function( opts , curr, next, fwd ) {
var css = opts.API.getSlideOpts( opts.nextSlide ).slideCss || {};
opts.API.stackSlides( curr, next, fwd );
opts.cssBefore = $.extend(css, { opacity: 1, display: 'block' });
opts.animOut = { opacity: 0 };
cleartype( true, opts, next );
},
after: function( opts, curr, next ) {
cleartype( false, opts, next );
}
}
});
})(jQuery);