你可以嘗試像 -
<img width="448" height="300" src="/Content/uploadedImg/1.png" id="hoverimage" />
<div id="showdiv" style="display:none;">Hidden initially, because of 'display:none;'</div>
<script>
$("#hoverimage").hover(function(){
//this happens when you first 'hover' over the image with id = 'hoverimage'
$("#showdiv").stop().fadeIn(500); //stop() is important, it prevents a 'queue' from building
//the .fadeIn(n) function will fade an element in over n milliseconds
}, function(){
//this happens when the mouse moves out/hover ends
$("#showdiv").stop().fadeOut(500);
//similarly, the fadeOut(n) function fades an element out over n ms
}
</script>
注意,對於這一點,你還需要包括jQuery庫,以利用jQuery(或$)功能。
見http://www.worthapost.com/articles/how-include-jquery-your-website-google更多關於該
我已經jQuery的包括但不工作,我需要在div上的圖像的頂部會顯示不低於其 – Beginner 2012-03-07 16:54:43
我有一個畫廊,並添加這個div攪亂佈局,我想tooltip/div懸停在圖像 – Beginner 2012-03-07 17:00:32
這是一個非常粗略的例子,沒有考慮到任何現有的佈局。您可以嘗試添加'style ='position:absolute;''並相應地放置它(這將需要圖像和div放在父div的'style ='position:relative;'')內。您在原始問題中提到您希望它出現在圖片下方 – solarise 2012-03-08 11:30:08