In this case, the fade of the picture triggered in this example is more common, but most of them are implemented with JS. You need to write a lot of events and functions to the image. If the picture is too much, the workload will be large. In order to alleviate our workload, you should use this very special thing - DHTML behavior (Behavior).
BEHAVIOR can move complex DHTML code from the page to a smaller, packaged, can be used again. Its purpose is to encapsulate specific functions in an HTC (HTML Component), which can be bundled on any element in the page. So I put all things into the HTC file, using HTC's specialty, we can easily give multiple pictures to this mouse triggering gradual effect.
Let's take a look at the specific effect demonstration: We first saw a translucent picture, when we put the mouse up, the picture was gradually displayed; the mouse was moved, the picture was getting worse.
OK. Let's take a look at the code used in inserting the picture insert:
-------------------------------------------------- -----------------------
.COOLALPHA {
Behavior: URL (Eyun_alpha.htc);
Cursor: Hand;
Filter: alpha (Opacity = 50);
}
->
style>
.
-------------------------------------------------- ----------------------------
It can be seen that the picture code is more than a "link" property than the ordinary tag. Its value is to click the path to open the file. This property is optional, if you don't write this property and attribute value, click on the picture and not happen. If you want to click on the image to call a function, for example: Alert ("Hello the World!"), Then you need to write: action = "Alert ('Hello the World!')". Note: The LINK is not able to appear at the same time.
And in the style section, we used
Behavior: URL (Eyun_alpha.htc) This special statement. among them,
Eyun_alpha.htc is Today's protagonist - encapsulated HTC files that realize the progressive results. Its code is as follows.
Eyun_alpha.htc code and its analysis are as follows. -------------------------------------------------- ---------------------