Skip to content

Commit

Permalink
Merge pull request #3 from miguelleite/master
Browse files Browse the repository at this point in the history
Add option to allow choosing the desired container to which the flakes w...
  • Loading branch information
joshmcrty committed Dec 22, 2014
2 parents 018ebb9 + e3409f1 commit 5e20b4b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
`transparency` determines the alpha value of color of the character

`container` determines the element to which the flakes will be appended to
5 changes: 3 additions & 2 deletions jquery.flurry.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
variance: 20,
preventScroll: true,
character: "•",
transparency: 1
transparency: 1,
container: 'body'
}, options );

// Prevent browser horizontal scrolling
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion jquery.flurry.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* @author Josh McCarty <[email protected]>
* @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="<span>&bull;</span>";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);
*/(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="<span>&bull;</span>";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);

0 comments on commit 5e20b4b

Please sign in to comment.