Home » , » Zoom In/Out Images On Mouse Hover With Single Image

Zoom In/Out Images On Mouse Hover With Single Image



[a href="http://lh6.ggpht.com/-IYDW6Kz1aG0/TgeAekNsfaI/AAAAAAAAD9s/dBPq6EYoLfg/s1600-h/zoom-images%25255B10%25255D.png"]zoom-images[/a]There are many tutorials online which show users how to achieve a hover effect on their buttons and other images using mouse hover and they often instruct to use a second, larger image.  Another method used is using jQuery to enlarge the size of the image. But with a little bit of trickery, this can be done solely using Css3 and normal html.

Here is a demo:



[a href="http://www.blogger.com/post-edit.g?blogID=8193278726666811965&postID=4960894755779778317&from=pencil#demo"]Live Demo[/a]




Note : This trick is best viewed in the latest version of any browser other than IE.

This tutorial has been split into two parts:


  1. CSS implementation

  2. HTML Implementation





CSS implementation:


1. Go To Blogger > Design > Edit HTML

2. and search for


]]></b:skin>


3. Now right above it, paste this code:


/*------- MBT ZOOM-OUT ZOOM-IN -------*/

.mbtzoom {
padding:5px;
position:fixed;
bottom: 35px;
right:10px;
cursor: pointer;
text-decoration: none;
border: 0px solid transparent;
-moz-transition: all 0.3s ease-out; 
-o-transition: all 0.3s ease-out; 
-webkit-transition: all 0.3s ease-out; 
-ms-transition: all 0.3s ease-out; 
transition: all 0.3s ease-out; 
}

.mbtzoom:hover  {
  zoom: 2;
  text-enlarge: 2;
  -moz-transform: scale(2);
  -o-transform: scale(2);
  transform: scale(2);
}



Same procedure as the other option, edit the values to your picture, and change the zoom to how big you want the picture after the transition.




HTML Implementation:


Now whenever you wish to apply the zoom effect to any image you want simply use this code,


<a href="URL OF PAGE" class="mbtzoom"><img  width="60px" height="60px" src="IMAGE LINK" alt="back to top"  /></a>


  • Replace URL OF PAGE with the page link. On clicking the image the user will be taken to that page

  • Replace IMAGE LINK with the link of the picture

  • Make sure to Keep width and height equal to half the size of original image. For example if the image size is 100px by 100px then set width="50px" and height="50px"




That’s it! Your image should be zooming/enlarging beautifully on your blog/website!


DEMO


As a [a href="" name="demo"]DEMO[/a] simply paste this code on MBT HTML Editor




<style>
.mbtzoom {
padding:5px;
position:fixed;
bottom: 35px;
right:10px;
cursor: pointer;
text-decoration: none;
border: 0px solid transparent;
-moz-transition: all 0.3s ease-out; 
-o-transition: all 0.3s ease-out; 
-webkit-transition: all 0.3s ease-out; 
-ms-transition: all 0.3s ease-out; 
transition: all 0.3s ease-out; 
}

.mbtzoom:hover  {
  zoom: 2;
  text-enlarge: 2;
  -moz-transform: scale(2);
  -o-transform: scale(2);
  transform: scale(2);
}
</style>

<a href="#" class="mbtzoom"><img  width="60px" height="60px" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHDe291OD-F5IaoHyGeRS_GYVoWlLigVpHWtauJP0keYRPTHXmwBPN1vBE9qqkEjN19VDRN-snRREnQGqcpd7wAjKAZb8zSdeTULJvzdCzYLzJbQhqgnYEExFEePuspZIKuQJYbZpFUI4/s800/rss-128.png" alt="back to top"  /></a>






Anims



About the Guest Author:

Anims is freelance web designer and enjoys playing around with and learning coding in his free time. He likes to write about Web Technologies such as HTML, CSS and SEO.



Source: http://www.mybloggertricks.com/2011/06/zoom-inout-images-on-mouse-hover-with.html

0 comments :

Post a Comment

 
Play : Agame | Y8 Games | Y3 Games
Copyright © 2011. Blogger Tips And Tricks 2012 - All Rights Reserved

Proudly powered by Blogger