Using CSS to implement mouse click Effects _css/html

Source: Internet
Author: User
If you can apply CSS well, your homepage will be well-dressed. The following is to introduce a mouse with CSS to make a special click.

1. Copy the following code to your home page and between.

〈style〉.shadow {
Filter:shadow (color=blue,direction=225)
}
. shadow1 {
Filter:shadow (color=red,direction=225)
}
. shadow2 {
Filter:shadow (color=green,direction=225)
}
. div {
Cursor:move; Filter:blur (add=ture,direction=135,strength=10); width:800px
}
〈/style〉

The blur filter is applied here.

2, insert a picture in the page, for example I insert is 〈img border= "0" src= "/article/uploadpic/2005-9/200598478474.jpg" width= "" height= "210". Before it joins 〈TD id=flttgt style= "Filter:light (enabled=1), ' ' Width '" width=315〉.

In the next line we inserted the picture just now add 〈td style= "Vertical-align:top" width=314〉

3, after setting the picture properties, we also apply JavaScript script code, that is, to make the picture follow the mouse to move some effects, the code is as follows.

〈script language=javascript〉
〈!--
var g_numlights=0;
The Var blurbs= new Array ("Now the live filter gives the page more interactive performance in response to the user's actions.") "," We used a light filter to respond to user clicks. Click on the image to increase the light source. "," Moves the light by capturing the location of the user's mouse. "," does not require too much programming. ");
Window.onload=setlights;
Document.onclick=keyhandler;
Flttgt.onmousemove=mousehandler;
function Setlights () {
Flttgt.filters[0].clear ();
Flttgt.filters[0].addcone (0,0,5,100,100,225,225,0,60,15);
if (g_numlights>0) {
Flttgt.filters[0].addcone (400,170,5,100,100,225,0,0,160,15);
if (g_numlights>1) {
Flttgt.filters[0].addcone (320,330,5,100,100,0,225,225,60,15);
}
}
}
function Keyhandler ()
{
G_numlights= (g_numlights+=1)%4;
Holder.innerhtml=blurbs[g_numlights];
Setlights ();
}
function Mousehandler ()
{
x= (window.event.x-80);
Y= (window.event.y-80);
Flttgt.filters[0].movelight (1,x,y,5,1);
if (g_numlights>0) {
Flttgt.filters[0].movelight (1,x,y,5,1);
if (g_numlights>1)
{
Flttgt.filters[0].movelight (2,x,y,5,1);
}
}
}
〈/script〉

This will set up a more personalized picture effect

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.