Image Reflection with jQuery, MooTools and script.aculo.us
Posted on January 11, 2009, Filled under JQuery, JavaScript, MooTools,
Bookmark it
Thanks for visiting our website! We regularly publish posts like this one. If you are interested in receiving the latest updates as soon as they are posted, please consider subscribing to the RSS feed or to our e-mail newsletter.
Reflection.js for jQuery is an improved version of the reflexion.js script rewritten for the JQuery library. It’s easy to integrate, as you only need 2 files to call: the (latest) JQuery Library file and the Reflexion JS File. You can add instantaneous reflexion effects to your images in modern browsers in less then 2KB.
Some advantages of this new script:
* The reflection appear instantly under each image, after each image is loaded, without having to wait for all images to load and apply the reflection for all at the same time.
* The new code has a smaller size than the original reflection.js, being optimized for JQuery.
* The code has a few bug fixes that the original script doesn’t have. It usually works better.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<html>
<head>
<title>Image Reflexion with JQuery</title>
<script type="text/javascript" src="js/jquery-1.2.6.min.js"></script>
<script type="text/javascript" src="js/jquery.reflection.js"></script>
<script type="text/javascript">
<!--
// Code moves from jquery.reflection.js
jQuery(function($) {
$("img.reflect").reflect({/* Put custom options here */});
});
//-->
</script>
</head>
<body>
<img alt='' src='images/js-logo.png' class='reflect'><br />
<img alt='' src='images/image-one.png' class='reflect'><br />
<img alt='' src='images/image-two.png' class='reflect'>
</body>
</html>
As you can notice a CSS class named ‘reflect’ is applied to the images. This uses the default reflection parameters:
$("img.reflect").reflect({/* Put custom options here */});
If you need to remove reflexion you can call the unreflect() method on a JQuery selector:
$("#photo_id_here").unreflect();
More information regarding the usage of this script can be found on the script’s page.
Reflection.js for MooTools is an improved version of the reflexion.js script rewritten for the MooTools JavaScript framework. The script has the same image reflection effect and features as the Reflection.js for JQuery.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<html>
<head>
<title>Image Reflection with MooTools</title>
<script type="text/javascript" src="js/mootools.js"></script>
<script type="text/javascript" src="js/mootools.reflection.js"></script>
<script type="text/javascript">
<!--
// Code moved from mootools.reflection.js
window.addEvent("domready", function() {
$$("img").filter(function(img) {
return img.hasClass("reflect");
}).reflect({/* Put custom options here */});
});
//-->
</script>
</head>
<body>
<img alt='' src='images/mootools.jpg' class='reflect'><br />
<img alt='' src='images/image-one.png' class='reflect'><br />
<img alt='' src='images/image-two.png' class='reflect'>
</body>
</html>
script.aculo.us Reflector is a script that uses opacity-based fades and works on any background, including image-based backgrounds.
Click here to view the script in action (check the source of the page to understand how it works).
Do you wish to receive the latest updates as soon as they are posted? Get our RSS Feed or Subscribe to the Newsletter!
- January 11, 2009
- article by Gabriel C.
- 2 comments
Sponsors
Related Posts
-
How to use the Scroll Effect in jQuery, MooTools and Script.aculo.usat March 16, 2009 with 5 comments
-
Highlight Elements in Script.aculo.us, jQuery and MooToolsat March 29, 2009 with 1 comment
-
Image Cropping with jQuery, MooTools, Prototype & script.aculo.usat December 22, 2008
-
Zoom Images using jQuery and MooToolsat December 21, 2008 with 1 comment
-
Easily add Captions to your Images with jQuery and MooToolsat August 12, 2009



2 Replies to "Image Reflection with jQuery, MooTools and script.aculo.us"
April 29, 2009 at 1:43 PM
Muito bom !! gostei muito da dica ! abraços !!
July 30, 2009 at 10:02 AM
hello, i used this addon, it was very useful, but i have a problem, i used it with an horizontal slide image gallery (Mootools) when i added the reflexion to it , it was converted to vertical! what should i do? anyhelp pleasse
thanks