diff --git a/README.md b/README.md index 314f314..2921955 100644 --- a/README.md +++ b/README.md @@ -44,4 +44,6 @@ Options `character` determines the character or html entity to be replicated as a snowflake -`transparency` determines the alpha value of color of the character \ No newline at end of file +`transparency` determines the alpha value of color of the character + +`container` determines the element to which the flakes will be appended to \ No newline at end of file diff --git a/jquery.flurry.js b/jquery.flurry.js index 102ebea..57bd168 100644 --- a/jquery.flurry.js +++ b/jquery.flurry.js @@ -23,7 +23,8 @@ variance: 20, preventScroll: true, character: "•", - transparency: 1 + transparency: 1, + container: 'body' }, options ); // Prevent browser horizontal scrolling @@ -59,7 +60,7 @@ "top": "-" + settings.large + "px", "left": left + "px", "z-index": "999" - }).appendTo( 'body' ).animate({ + }).appendTo( settings.container ).animate({ "top": settings.height + "px", "left": ( left + randomNumberInRange( settings.wind - settings.variance, settings.wind + settings.variance ) ) + "px", "opacity": 0 diff --git a/jquery.flurry.min.js b/jquery.flurry.min.js index cdb4fbf..ff60eeb 100644 --- a/jquery.flurry.min.js +++ b/jquery.flurry.min.js @@ -7,4 +7,4 @@ * @author Josh McCarty * @copyright 2013 Josh McCarty * @license https://github.com/joshmcrty/Flurry/blob/master/LICENSE GPLv2 - */(function(e){e.fn.flurry=function(t){var n=e.extend({height:150,density:100,speed:3e3,small:12,large:20,wind:40,variance:20,preventScroll:!0},t);n.preventScroll===!0&&e("html").css({"overflow-x":"hidden"});var r=e(window).width();e(window).resize(function(){r=e(window).width()});var i=function(e,t){return Math.random()*(t-e)+e},s=function(){var t=i(0-Math.abs(n.wind),r+Math.abs(n.wind)),s="";e(s).css({color:"#FFF","font-size":i(n.small,n.large)+"px",position:"absolute",top:"-"+n.large+"px",left:t+"px","z-index":"999"}).appendTo("body").animate({top:n.height+"px",left:t+i(n.wind-n.variance,n.wind+n.variance)+"px",opacity:0},i(n.speed-400,n.speed+400),"linear",function(){e(this).remove()})};setInterval(s,n.density)}})(jQuery); \ No newline at end of file + */(function(e){e.fn.flurry=function(t){var n=e.extend({height:150,density:100,speed:3e3,small:12,large:20,wind:40,variance:20,preventScroll:!0,container:'body'},t);n.preventScroll===!0&&e("html").css({"overflow-x":"hidden"});var r=e(window).width();e(window).resize(function(){r=e(window).width()});var i=function(e,t){return Math.random()*(t-e)+e},s=function(){var t=i(0-Math.abs(n.wind),r+Math.abs(n.wind)),s="";e(s).css({color:"#FFF","font-size":i(n.small,n.large)+"px",position:"absolute",top:"-"+n.large+"px",left:t+"px","z-index":"999"}).appendTo(n.container).animate({top:n.height+"px",left:t+i(n.wind-n.variance,n.wind+n.variance)+"px",opacity:0},i(n.speed-400,n.speed+400),"linear",function(){e(this).remove()})};setInterval(s,n.density)}})(jQuery); \ No newline at end of file