-
Notifications
You must be signed in to change notification settings - Fork 52
/
sample091.html
28 lines (28 loc) · 1.12 KB
/
sample091.html
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
<!DOCTYPE html>
<html lang="en">
<body>
<div>Out And In Fade</div>
<div>Out And In Fade</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script> (function ($) {
$.fn.outAndInFade = function (customOptions) {
var options = $.extend({}, $.fn.outAndInFade.defaultOptions, customOptions || {});
return this.each(function () {
$(this).fadeOut().fadeIn('normal', function () { // Callback for fadeIn()
// Call complete() function, pass it "this"
if ($.isFunction(options.complete)) {
options.complete.apply(this);
}
});
});
};
$.fn.outAndInFade.defaultOptions = {
complete: null // No default function
};
})(jQuery); jQuery('div').outAndInFade({
// Change background-color of the element being animated on complete.
// Note: "this" will refer to the DOM element in the wrapper set.
complete: function () { $(this).css('background', '#ff9'); }
}); </script>
</body>
</html>