JavaScript / jQuery hover menu - edit link

Izi

Izi

Soldato
Joined
9 Dec 2007
Posts
2,718
Hi,

capturen.png


I need a link to appear next to the images here when the user hovers over them. It will have a link in it to edit the picture. This will be dynamic and pulled from the database so each link will be unique.

ie

<a href="editImage.aspx?imageid=1">Edit</a>
<a href="editImage.aspx?imageid=2">Edit</a>
<a href="editImage.aspx?imageid=3">Edit</a>
<a href="editImage.aspx?imageid=4">Edit</a>

and so forth.

Thanks for any help!
 
There is probably a better way, but I'm still learning and this is all I could come up with quickly.

Code:
$(document).ready(function(){
	$(".galleryLink").hide();
	$(".galleryImg").hover(function(){
		$(this).children(".galleryLink").show()
	});
});

With your html like so

Code:
<div class="galleryImg">
	<img src="image.jpg" alt="" />
        <div class="galleryLink"><a href="#">Edit</a></div>
</div>
 
Last edited:
Back
Top Bottom