How to open fancybox using map link

一曲冷凌霜 提交于 2019-12-17 17:12:04

问题


The link was given to a jpg file using map.

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

how can i open fancybox using that link?


回答1:


Simply use this script

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

Make sure you add the right API options for the version you are using (if your href targets an image, you may not need any)

If using v1.3.4 check http://fancybox.net/api.

For v2.x check http://fancyapps.com/fancybox/#docs




回答2:


$('#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();
});


来源:https://stackoverflow.com/questions/11412483/how-to-open-fancybox-using-map-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!