When you click on the link, it with display the div “somecontent”. And if you click on the link again, it will hide. How can I make the div show when hovering over the link and hide when moving away instead of showing and hiding on click?
Here is the code:
<script type="text/javascript">
$(document).ready(function(){
$(".showcontent").click(function(){
$(".somecontent").toggle("fast");
});
});
</script>
<a class="showcontent" href="">Show</a>
<div class="somecontent">
<p>some content</p>
</div>
Just replace/remove the click event and add mouseover and mouseout (you can chain on the original element selection).
Edit: With Colin’s Suggestion..
A little refactoring of the elements, this should provide the results you want.