You have the answer to this question in your post: hover The CSS would be this:
#eq1:hover {
background-image: url ('../link_to_file.png');
}
jQuery:
You can do that in jQuery. But to do that in jQuery would be this, and also, do you have an image? I will tell you how to link the image. Use your image for that.
Example:
$(document).ready(function () {
$("#eq1").mouseover(function () { // function to run, when mouse comes over eq1
$("div").css("background", "image_image_link.png");
}
});
Instead of using div
you can use (this).parent
too because you said, you wanted the image to show up for the parent div. You can repeart the code for all of the three links.
Note: You cannot add CSS properties to some other divs in CSS, for that you must use jQuery.
Edit:
You wanted to add the images in some other div. That would be something like:
<div class="all-images">Add all the images here..</div>
<div class="image-viewer"></div>
Now what this actually is something like this: The .all-images
is the container, that will contain all the images like thumbnails. And the .image-viewer
will be used to show the image.
$(document).ready(function () {
$(".all-images").click(function () { //
$(".image-viewer").css("background", "image_image_link.png");
}
});
In the example I used, the click on the the image (.all-images
) will show the image in the div. But remember to use something like a name of the image. Because jQuery won't remember which image was clicked. You can use something like src
of that img
.