Displaying data on Hover using Jquery and HTML
This feature is used to display the details relating to each photo when the user's mouse is in that area of the page.For our first pass at displaying this information, we use the .hover() method.When the cursor enters a photo's boundary, the associated information fades in to 70 percent opacity, and when it leaves, the information fades back out.There are, of course, multiple ways to perform this task. Since a portion of each handler is the same, it's possible to combine the two handlers to reduce code duplication.You can download the source code of this topic.
JavaScript.js
<script type="text/javascript">
$(document).ready(function() {
$('.photo').hover(function() {
$(this).find('.details').fadeTo('fast', 0.7);
}, function() {
$(this).find('.details').fadeOut('fast');
});
});
</script>
$(document).ready(function() {
$('.photo').hover(function() {
$(this).find('.details').fadeTo('fast', 0.7);
}, function() {
$(this).find('.details').fadeOut('fast');
});
});
</script>
Comments
Post a Comment