Saturday, January 26, 2013
0
Saturday, January 26, 2013
Unknown
Mist Falling Effect for Blogger and Wordpress
Mist falling effect is one of the effect which is same as that of the previous post of cursor sparkel effect this effect works fine for all blog now we are ready to update as the cursor sparkel works when cursor moved.Now we going to add a new effect called mist falling which falls without any action.This effect is designed to have more customizing options,that works fine and customizable.
Mist falling effect Implementation
Method 1:
1. Login to blogger.
2. Then click layout in blogger.
3.Then open a html/javascript widget
4.Then copy and paste the below code and save the widget.
5.The view the blog there will be mist falling from top.
Method 2:
This is the direct implementation of widget in blogger template just copy and paste the below code just inside or before the closing body tag.
</body>
Mist falling code
<script type='text/javascript'>
//Configure here.
var num = 40; //Number of flakes
var timer = 30; //setTimeout speed. Varies on different comps
var enableinNS6 = 1 //Enable script in NS6/Mozilla? Snow animation could be slow in those browsers. (1=yes, 0=no).
//End.
var y = [];
var x = [];
var fall = [];
var theFlakes = [];
var sfs = [];
var step = [];
var currStep = [];
var h,w,r;
var d = document;
var pix = "px";
var domWw = (typeof window.innerWidth == "number");
var domSy = (typeof window.pageYOffset == "number");
var idx = d.getElementsByTagName('div').length;
if (d.documentElement.style &&
typeof d.documentElement.style.MozOpacity == "string")
num = 12;
for (i = 0; i < num; i++){
sfs[i] = Math.round(1 + Math.random() * 1);
document.write('<div id="flake'+(idx+i)+'" style="position:absolute;top:0px;left:0px;width:'
+sfs[i]+'px;height:'+sfs[2]+'px;background-color:red;font-size:'+sfs[2]+'px"><\/div>');
currStep[i] = 0;
fall[i] = (sfs[i] == 1)?
Math.round(2 + Math.random() * 2): Math.round(3 + Math.random() * 2);
step[i] = (sfs[i] == 1)?
0.05 + Math.random() * 0.1 : 0.05 + Math.random() * 0.05 ;
}
</script>
<script type="text/javascript" />
if ((document.getElementById) &&
window.addEventListener || window.attachEvent){
(function(){
if (domWw) r = window;
else{
if (d.documentElement &&
typeof d.documentElement.clientWidth == "number" &&
d.documentElement.clientWidth != 0)
r = d.documentElement;
else{
if (d.body &&
typeof d.body.clientWidth == "number")
r = d.body;
}
}
function winsize(){
var oh,sy,ow,sx,rh,rw;
if (domWw){
if (d.documentElement && d.defaultView &&
typeof d.defaultView.scrollMaxY == "number"){
oh = d.documentElement.offsetHeight;
sy = d.defaultView.scrollMaxY;
ow = d.documentElement.offsetWidth;
sx = d.defaultView.scrollMaxX;
rh = oh-sy;
rw = ow-sx;
}
else{
rh = r.innerHeight;
rw = r.innerWidth;
}
h = rh - 2;
w = rw - 2;
}
else{
h = r.clientHeight - 2;
w = r.clientWidth - 2;
}
}
function scrl(yx){
var y,x;
if (domSy){
y = r.pageYOffset;
x = r.pageXOffset;
}
else{
y = r.scrollTop;
x = r.scrollLeft;
}
return (yx == 0)?y:x;
}
function snow(){
var dy,dx;
for (i = 0; i < num; i++){
dy = fall[i];
dx = fall[i] * Math.cos(currStep[i]);
y[i]+=dy;
x[i]+=dx;
if (x[i] >= w || y[i] >= h){
y[i] = -10;
x[i] = Math.round(Math.random() * w);
fall[i] = (sfs[i] == 1)?
Math.round(2 + Math.random() * 2): Math.round(3 + Math.random() * 2);
step[i] = (sfs[i] == 1)?
0.05 + Math.random() * 0.1 : 0.05 + Math.random() * 0.05 ;
}
theFlakes[i].top = y[i] + scrl(0) + pix;
theFlakes[i].left = x[i] + scrl(1) + pix;
currStep[i]+=step[i];
}
setTimeout(snow,timer);
}
function init(){
winsize();
for (i = 0; i < num; i++){
theFlakes[i] = document.getElementById("flake"+(idx+i)).style;
y[i] = Math.round(Math.random()*h);
x[i] = Math.round(Math.random()*w);
}
snow();
}
if (window.addEventListener){
window.addEventListener("resize",winsize,false);
window.addEventListener("load",init,false);
}
else if (window.attachEvent){
window.attachEvent("onresize",winsize);
window.attachEvent("onload",init);
}
})();
}//End.
</script><a href="http://www.blog4al.com" target="_blank">Mist falling Effect</a>
Number of Mist fall
var num = 40 this line is used to 40 is number of mist falls in that particular window and it can be changed to any number but 40 is recommended as it won't irritate the visitors as they enjoy.
Time Out
Var Timer= 30 is to exit after that of 30 seconds that mist will disappear and won't fall.If you want fall contineously then change it to 0 then it will be fall without any time limit.
change color of Mist
As mist generally in white color but in blog there may be light template and dark template.For us our light template we use the Red color change that to any color you want.you can also use color code generator.
Then save the widget it will work fine,having any trouble ? just comment below.
Related Articles :
Do you like this article? Spread the words!
If you enjoyed this post, please consider leaving a comment or subscribing to the E-mail feed to have future articles delivered to your feed reader.
Subscribe to:
Post Comments
(
Atom
)
0 Responses to “ Mist Falling Effect for Blogger and Wordpress ”
Post a Comment