2011-08-27 29 views
0

我需要在網站上顯示一些圖形圖表數據。在這些圖表中有幾個圖像,點擊時應顯示圖像的較大版本。圖表本身當前保存爲單個圖像文件。將圖像作爲圖像映射或有其他替代方法嗎?

我最初的想法是使用圖像映射來指定圖像在整個圖表圖像中的位置,然後使用jQuery來突出顯示圖像的邊緣。然後使用諸如lightbox或fancybox之類的東西顯示點擊圖像的較大版本。

我希望得到的一些見解是,這是達到預期結果的最佳方式,還是有更好的技術?

謝謝

回答

1

爲什麼不只是使用工具提示?

下面是一個example using qTip2,用一些借來的代碼;)

HTML

<img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap" /> 

<map name="planetmap"> 
    <area shape="rect" coords="0,0,82,126" alt="Sun" href="#" title="<img src='sun.gif'>" /> 
    <area shape="circle" coords="90,58,3" alt="Mercury" href="#" title="<img src='merglobe.gif'>" /> 
    <area shape="circle" coords="124,58,8" alt="Venus" href="#" title="<img src='venglobe.gif'>" /> 
</map> 

腳本

$('area').qtip({ 
    position: { 
     my: 'left center', 
     at: 'right center', 
     target: $('img') 
    } 
}); 
相關問題