jquery - Loading javascript effect inside DIV element -
so found effect , i'm trying modify loaded inside div myeffect
, example:
<html> <head></head> <body> <div class="myeffect"></div> </body> </html>
i tried changing variables i'm not javascript expert , can't work inside dic. effect covers whole screen top bottom.
the code on codepen , can found here: https://codepen.io/emilykarp/pen/bvqxrm
help welcome.
hope helps
var speeds = []; var count = 1; var colors = ['#bf1e2e', '#ee4037', '#dc5323', '#e1861b', '#e1921e', '#f7ac40', '#f7e930', '#d1da22', '#8bc43f', '#38b349', '#008d42', '#006738', '#29b473', '#00a69c', '#26a9e1', '#1a75bb', '#2a388f', '#262161', '#652d90', '#8e2792', '#9e1f64', '#d91c5c', '#ed297b', '#d91c5c', '#db1e5e', '#bf1e2e', '#f6931e', '#f05a28', '#f6931e', '#fbaf41'] var width = parseint($('html').css('width'), 10); var random = function(mult, add) { return math.floor((math.random()*mult) + add); }; var drop = function(n, height, color) { $('.myeffect').append('<div class="drop" style="left:'+ n*15+'px;height:'+ height+'vh;background-color:'+ color+';"></div>'); }; var createdrops = function(space) { (var i=speeds.length; < space/10; i++) { speeds.push(random(3000, 2000)); drop(i, random(70, 30), colors[count]); if (count < colors.length-1) { count++; } else { count = 0; } } }; var animatedrops = function(startingn) { (var i=startingn; i<speeds.length; i++) { $('.drop:nth-child('+i+')').slidedown(speeds[i]); } }; createdrops(width); animatedrops(0);
.drop { width: 16px; height: 200px; display: none; border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; position: absolute; top: 0; -webkit-box-shadow: inset -4px -8px 16px -6px rgba(0,0,0,0.47); -moz-box-shadow: inset -4px -8px 16px -6px rgba(0,0,0,0.47); box-shadow: inset -4px -8px 16px -6px rgba(0,0,0,0.47); }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="myeffect" ></div>
Comments
Post a Comment