1/*
2 * jQuery.appear
3 * https://github.com/bas2k/jquery.appear/
4 * http://code.google.com/p/jquery-appear/
5 * http://bas2k.ru/
6 *
7 * Copyright (c) 2009 Michael Hixson
8 * Copyright (c) 2012-2014 Alexander Brovikov
9 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
10 */
11(function($) {
12 $.fn.appear = function(fn, options) {
13
14 var settings = $.extend({
15
16 //arbitrary data to pass to fn
17 data: undefined,
18
19 //call fn only on the first appear?
20 one: true,
21
22 // X & Y accuracy
23 accX: 0,
24 accY: 0
25
26 }, options);
27
28 return this.each(function() {
29
30 var t = $(this);
31
32 //whether the element is currently visible
33 t.appeared = false;
34
35 if (!fn) {
36
37 //trigger the custom event
38 t.trigger('appear', settings.data);
39 return;
40 }
...
</html>