2012-07-10 57 views
1

使用地圖將鏈接提供給jpg文件。如何使用地圖鏈接打開fancybox

<map name="Map" id="Map"> 
<area shape="rect" coords="350,350,350,350" href="......" target="_new" /> 
</map> 

我該如何打開fancybox使用該鏈接?

+0

我想開的fancybox同時點擊地圖中的圖片 – 2012-07-10 12:26:18

回答

1

只需使用這個腳本

$(document).ready(function(){ 
$("#Map area").fancybox({ 
    // API options here 
}); // fancybox 
});//ready 

請確保您添加的版本,您使用的是正確的API選項(如果你href目標的圖像,你可能不需要任何)

如果使用v1.3.4,請檢查http://fancybox.net/api

對於V2.X檢查http://fancyapps.com/fancybox/#docs

0
$('#Map area').click(function(e){  // On click of <area> tag 
    var href = $(this).attr('href'); // Get the href param 
    $.fancybox({      // Open fancybox 
     'href' : href, 
     'width' : 350, 
     'height' : 'auto' 
    }); 

    e.preventDefault(); 
});