This time I will share jQuery Plugin and tutorial about Simple Image Hover Effect with jQuery and CSS/CSS3, hope it will help you in programming stack.
A simplest way to create a CSS3 animated, customizable overlay effect when users hovers over an element. jQuery is used only to make the overlay open / close on hover by toggling CSS classes.
How to use it:
1. Create an overlay element for the container ‘content’ following the markup structure like this:
2 |
< a class = "box overlay" href = "#" > |
3 |
< span class = "image-caption" >Image Caption</ span > |
4 |
< span class = "desc overlay-toggle" > |
6 |
< span class = "see-more" >See more...</ span > |
2. Style the overlay.
02 |
display : inline- block ; |
05 |
transition: all ease-in 0.3 s; |
08 |
.box:hover { background-color : rgba( 0 , 0 , 0 , 0.5 ); } |
10 |
.box:hover .image- caption { |
11 |
background-color : transparent ; |
17 |
display : inline- block ; |
22 |
text-transform : uppercase ; |
23 |
font-family : Helvetica , Arial , sans-serif ; |
25 |
text-shadow : 0px 2px 2px rgba( 0 , 0 , 0 , 0.8 ); |
27 |
background-color : rgba( 0 , 0 , 0 , 0.7 ); |
28 |
transition: all ease-in 0.3 s; |
35 |
text-decoration : none ; |
37 |
font-family : Georgia, serif ; |
42 |
text-shadow : 0px 2px 2px rgba( 0 , 0 , 0 , 0 ); |
43 |
transition: all ease-in 0.3 s; |
46 |
.see-more { text-decoration : underline ; } |
3. Add a background image to the ‘content’
5 |
background : url (bg.jpg) no-repeat ; |
6 |
background- size : 370px 270px ; |
4. Customize the CSS styles of your overlay on mouse hover.
3 |
text-shadow : 0px 2px 2px rgba( 0 , 0 , 0 , 0.8 ); |
5. Apply the ‘on’ CSS class to the overlay on hover. Insert the following JavaScript snippet after jQuery library and we’re done.
3 |
$( ".overlay-toggle" ).toggleClass( "on" ); |
This awesome jQuery plugin is developed by thomashardy. For more Advanced Usages, please check the demo page or visit the official website.