Thursday, May 26, 2011

Easy Image Zoom with jQuery

Posted by Unknown On Thursday, May 26, 2011 No comments

easy zoom
image by: cssglobe.com



The task was to create a script that will allow users to see large details of the product while moving cursor over medium sized image.

This plugin is customizable with several options and simple CSS definitions. In terms of CSS all you need to do is define the newly created image zoom element's size, position and appearance.

This all the code.
<html>
<head>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>

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

<script type="text/javascript">
jQuery(function($){

$('a.zoom').easyZoom();

});
</script>

<style type="text/css">
#container{
padding:10px;
}
#easy_zoom{
width:600px;
height:400px;
border:5px solid #eee;
background:#fff;
color:#333;
position:absolute;
top:60px;
left:400px;
overflow:hidden;
-moz-box-shadow:0 0 10px #777;
-webkit-box-shadow:0 0 10px #777;
box-shadow:0 0 10px #777;
/* vertical and horizontal alignment used for preloader text */
line-height:400px;
text-align:center;
}
</style>
</head>

<body>

<div id="container">
<p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe_RaBzZ9EWECT-3Gk5ovZGuUGSvMEXtzB-pFLNyoYBqikrQZ9wJPhLrbbBnDq0a_7KxJwk5HLA5Q19Jlncv6aVKLOgCVhuFnq55WyCxjDVaz5Z0cOzbbPkXfd7KVqdNyyU__HfBcHo-s/s1600/New-York.jpg" class="zoom"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjE0ndp4JOVlYw1fSTswpKSXcq1JQ7cMea09ENumOu54IBSj4fGB56sHWmPoF7fJLu6kuoPP8yubHkxU9RwvKPl0E7u8eVr5toxRsGLT3L8ufQSRue0C51FpTx1G5WjgacGKYvp7Uh8EiM/" alt="New York"></a></p>
<p><em>Roll over the image to view details.</em></p>
</div>

</body>
</html>

source article : jQuery plugin: Easy Image Zoom

CSS Circle Button

Posted by Unknown On Thursday, May 26, 2011 No comments

Circle Button
image by: superdit.com

See Demo at the bottom of the page.

With the new features that CSS3 have creating a variety of button. In this example, radius of the border, padding the button, the height and width modified, it can look like a circle. And added the rotateX property that currently only supported in web kit browser, to make it look like from different angle.

This all the simple code.
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
body {
font-family: Arial, sans-serif;
}
#container {
margin: 120px auto;
text-align: center;
}
.button {
-webkit-transform: rotateX( 35deg );
position: relative;
display: inline-block;
width: 100px;
padding: 42px 15px;
margin: 0px 10px;
background-color: #C91826;
color: #fff;
font-weight: bold;
font-size: 40px;
text-decoration: none;
text-align: center;
text-shadow: 0px -1px 0px rgba(0,0,0,0.5);
border: 1px solid;
border-color: #B21522;
border-radius: 78px;
-moz-border-radius: 78px;
-webkit-border-radius: 78px;
box-shadow: inset 0px -4px 5px rgba(255,255,255,0.2),
inset 0px 1px 5px rgba(255,255,255,0.2),
/**/
0px 12px 0px #231F20,
0px 14px 0px #231F20,
0px 16px 0px #231F20,
/**/
0px 8px 5px rgba(0,0,0,0.5);
-moz-box-shadow: inset 0px -4px 5px rgba(255,255,255,0.2),
inset 0px 1px 5px rgba(255,255,255,0.2),
/**/
0px 12px 0px #231F20,
0px 14px 0px #231F20,
0px 16px 0px #231F20,
/**/
0px 8px 5px rgba(0,0,0,0.5);
-webkit-box-shadow: inset 5px -4px 5px rgba(255,255,255,0.2),
inset 5px 1px 5px rgba(255,255,255,0.2),
/**/
0px 12px 0px #231F20,
0px 14px 0px #231F20,
0px 16px 0px #231F20;
}
.button:hover {
background-color: #B21522;
color: #e3e3e3;
}
.button:active {
top: 8px;
box-shadow: inset 0px 4px 5px rgba(255,255,255,0.4),
inset 0px -1px 5px rgba(255,255,255,0.2),
/**/
0px 8px 0px #231F20,
/**/
0px 9px 5px rgba(0,0,0,0.5);
-moz-box-shadow: inset 0px 4px 5px rgba(255,255,255,0.4),
inset 0px -1px 5px rgba(255,255,255,0.2),
/**/
0px 8px 0px #231F20,
/**/
0px 9px 5px rgba(0,0,0,0.5);
-webkit-box-shadow: inset 0px 4px 5px rgba(255,255,255,0.4),
inset 0px -1px 5px rgba(255,255,255,0.2),
/**/
0px 8px 0px #231F20,
/**/
0px 9px 5px rgba(0,0,0,0.5);
}
</style>
</head>
<body>
<div id="container">
<a href="http://template4.blogspot.com/" target="blank" class="button">Push</a>
<a href="http://template4ublog.blogspot.com/" target="blank"" class="button">Stop</a>
</div>
</body>
</html>

source article : Create CSS Circle Button

Friday, May 20, 2011

Background Animations Using MooTools

Posted by Unknown On Friday, May 20, 2011 No comments

bg-clouds_640x300
One of the sweet effects made easy by JavaScript frameworks like MooTools and jQuery is animation. Here's a quick MooTools code snippet that shows how you can add animating a background image to any element on a page.

The CSS
#animate-area { 
background-image:url(clouds.png);
background-position:0px 0px;
background-repeat:repeat-x;
}

The first step is assigning the image as a background image for our given container. Be sure to repeat the background horizontally!

The HTML
<script src="http://ajax.googleapis.com/ajax/libs/mootools/1.3.1/mootools.js" type="text/javascript">
</script>
<script type="text/javascript">
window.addEvent('domready',function() {
//settings
var duration = 40000;
var length = 2000;
var count = 0;

var tweener;

// Executes the standard tween on the background position
var run = function() {
tweener.tween('background-position','-' + (++count * length) + 'px 0px');
};

// Defines the tween
tweener = $('animate-area').setStyle("background-position","0px 0px").set('tween',{ 
duration: duration, 
transition: Fx.Transitions.linear,
onComplete: run,
wait: false
});

// Starts the initial run of the transition
run();

});
</script>

The first step, as always is getting our settings ready for the show. The next piece is putting the animation function in place. We increment the negative background left position counter calculation to keep the show rolling. Last step is playing the show!

Make sure the animation speed is very slow and subtle -- a rapid background speed could make your users pass out. On the other hand, implementing it tastefully will make your website unique.

DEMO


source article : Background Animations Using MooTools