JavaScript implements image reflection-reflex. js and css implements text reflection

Source: Internet
Author: User

JavaScript implements image reflection-reflex. js and css implements text reflection

It is easy to use JavaScript to add reflection effects to images. You can add class = "reflect" to images that require reflection effects. For more information, see.

Current version: reflex. js 1.5

Mainstream browsers: Mozilla Firefox 1.5 +, Opera 9 +, Safari and IE6 +

Principle: re-draw an image using canvas to display the reflection effect

The usage is simple:

First of all, you must reference this js:

<script type="text/javascript" src="reflex.js"></script>

Then add the initialization class reflex to the corresponding img label class name.


First, only three app initialization images are displayed:

<div class="demo"></div><div class="demo"></div><div class="demo"></div>

The effect is as follows:

 

This script uses the CSS class to control the reflection. The class attribute is briefly introduced as follows:

  • Idistance: sets the reflected pixel height-min = 0 max = 100 default = 0
  • Iheight: sets the percentage height of reflection-min = 10 max = 100 default = 33
  • Iopacity: sets the transparency of reflection-min = 0 max = 100 default = 33
  • Iborder: Set the border's pixel width-min = 0 max = 100 default = 0
  • Icolor: Set the border color-min = 000000 max = ffffff default = f0f4ff
  • "Itiltright" or "itiltnone" or "itiltleft": sets the direction of the image, which is the right, unchanged, and left.

We try to change the transparency:

<div class="demo"><a href="img/album.jpg"></a></div><div class="demo"><a href="img/album.jpg"></a></div><div class="demo"><a href="img/album.jpg"></a></div>

The effect is as follows:

Then we change the other classes:

<div class="demo"></div><div class="demo"></div><div class="demo"></div>

The effect is as follows:

 

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.