1/** 2 * jquery.snow - jQuery Snow Effect Plugin 3 * 4 * Available under MIT licence 5 * 6 * @version 1 (21. Jan 2012) 7 * @author Ivan Lazarevic 8 * @requires jQuery 9 * @see http://workshop.rs 10 * 11 * @params flakeChar - the HTML char to animate 12 * @params minSize - min size of snowflake, 10 by default 13 * @params maxSize - max size of snowflake, 20 by default 14 * @params newOn - frequency in ms of appearing of new snowflake, 500 by default 15 * @params flakeColors - array of colors , #FFFFFF by default 16 * @params durationMillis - stop effect after duration 17 * @example $.fn.snow({ maxSize: 200, newOn: 1000 }); 18 */ 19(function ($) { 20 21 $.fn.snow = function (options) { 22 23 var $flake = $('<div class="flake" />').css({ 'position': 'absolute', 'top': '-50px' }), 24 documentHeight = $(document).height(), 25 documentWidth = $(document).width(), 26 defaults = { 27 flakeChar: "❄", 28 minSize: 10, 29 maxSize: 40, 30 newOn: 500, 31 flakeColor: ["#ffffff"], 32 durationMillis: null 33 }, 34 options = $.extend({}, defaults, options); 35 36 $flake.html(options.flakeChar); 37 38 var interval = setInterval(function () { 39 var startPositionLeft = Math.random() * documentWidth - 100, 40 startOpacity = 0.5 + Math.random(), 41 sizeFlake = options.minSize + Math.random() * options.maxSize, 42 endPositionTop = 500, 43 endPositionLeft = startPositionLeft - 100 + Math.random() * 200, 44 durationFall = 500 * 10 + Math.random() * 5000; 45 $flake 46 .clone() 47 .appendTo('body') 48 .css( 49 { 50 left: startPositionLeft, 51 opacity: startOpacity, 52 'font-size': sizeFlake, 53 color: options.flakeColor[Math.floor((Math.random() * options.flakeColor.length))] 54 } 55 ) 56 .animate( 57 { 58 top: endPositionTop, 59 left: endPositionLeft, 60 opacity: 0.2 61 }, 62 durationFall, 63 'linear', 64 function () { 65 $(this).remove() 66 } 67 ); 68 }, options.newOn); 69 70 if (options.durationMillis) { 71 setTimeout(function () { 72 removeInterval(interval); 73 }, options.durationMillis); 74 } 75 }; 76 77})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.