Text Blur effect with CSS and JQuery
How you would write code if you need to make a text blur on hover?? I had the same question and i am sharing what i got as a solution. The filter blur Just work for IE. I am changing a little bit in text-shadow to create the effect.
I have added some JQuery to make it more cool, When you move your mouse far from text the effect works.
This is the code for effect with Just CSS
Here the code that makes it live. This code updates the third parameter on mousemove.
HTML
Idea
I Got idea from the shadow created with the text-shadow property of CSS, That was blurry as i needed so i made the text transparent. What i got was the thing i was searching for. Yes the magic is in the third parameter of text-shadow: 0px 0px 10px #FF33FF;I have added some JQuery to make it more cool, When you move your mouse far from text the effect works.
Code
CSSThis is the code for effect with Just CSS
.blur{ display: block;
text-decoration: none;
font: 100px Georgia, sans-serif;
letter-spacing: -5px;
text-align: center; //these two lines do the magic color: transparent; text-shadow: 0px 0px 1px #FF33FF;
}
.blur:hover{
text-shadow: 0px 0px 10px #FF33FF;
}
Jquery Here the code that makes it live. This code updates the third parameter on mousemove.
$(document).ready(function() {
$(document).mousemove(function(e) {
if(e.pageY> 230)
$("#blur").css({'text-shadow': '0px 0px '+(( e.pageY - 230) / 18)+'px #FF33FF'})
else $("#blur").css({'text-shadow': '0px 0px 0px #FF33FF'});
});
});
HTML
<a href="http://motyar.blogspot.com" id="blur">With JQuery</a>
<a href="http://motyar.blogspot.com" class="blur">Pure CSS ( Hover me )</a>
Demo
You can see this code working well here.Labels: Animation, css, jquery
By : Motyar+ @motyar12 comments
islam barkah says…
can you give any thought about blur divs ?
Motyar says…
Nanoinfinity says…
I have a post about it on my blog including a demo of the spoiler tags in action:
http://philenotfound.blogspot.com/2010/07/spoiler-tags-text-blur-effect-with-css.html
I also created a list of browser support for both "color:transparent" and "text-shadow" including the versions they were introduced in. (Firefox, chrome, IE, Safari and Opera are listed) if anyone is wondering.
Important to note (due to their market share), IE supports neither transparent text nor text-shadow so the text renders as plain black.
Thank you very much for sharing this idea, it is exactly what I was looking for!
Motyar says…
Thang says…
Oytun Tez says…
But I have a bigger problem. I want to apply this bluring on DIVs. There are dynamic DIVs more than one on a page. I want to change the blur like you did with Jquery; closer the mouse less the blur. But it seems a little bit complicated to calculate all of the divs and change the blur of all of them in every move of the mouse...
Any idea?
raghibsuleman says…
http://www.raghibsuleman.com/
asiankid125 says…
I want to hover over the word to see it, and as my mouse gets further away from the word (vertically), I want it to shift to the blurry. But the word is at 50% height on the page.
Can the javascript be altered to blur based on relationship of the position of the mouse to the text itself, rather than the browser window?
markosansa says…
Something like this:
//set drawmode false
var draw= false;
$(document).ready(function() {
$(document).mousemove(function(e) {
if(e.pageY> 230)
$('.des').animate({'opacity: 0'+(( e.pageY - 230) / 18)}, 400);
$('.norm').animate({'opacity: 1'+(( e.pageY - 230) / 18)}, 400);
else
$('.des').animate({'opacity: 1'+(( e.pageY - 230) / 18)}, 400);
$('.norm').animate({'opacity: 0'+(( e.pageY - 230) / 18)}, 400);
});
});
I tried with this code but not work :(
Thank you in advance.
j3susFr33k says…
STYLE:
#blur{
display: block;
text-decoration: none;
font: 100px Georgia, sans-serif;
color:#6b1212; /*have to pick color here*/
letter-spacing: -5px;
text-align: center;
/*this line does the magic*/
filter: progid:DXImageTransform.Microsoft.Blur(pixelradius=3);
}
#blur:hover{
filter: progid:DXImageTransform.Microsoft.Blur(pixelradius=0);
JAVASCRIPT:


Post a Comment