-
-
Save anonymous/2972293 to your computer and use it in GitHub Desktop.
fancybox clickable map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- クリックでfancyboxを機動させる画像と、ポップアップさせたい画像の記述 --> | |
<a href="http://jsrun.it/assets/o/x/g/D/oxgDY.jpg" class="fancybox"> | |
<img src="http://jsrun.it/assets/o/x/g/D/oxgDY.jpg" width="200" /> | |
</a> | |
<!-- ポップアップした画像に貼られるクリッカブルマップの設定です --> | |
<map name="Map" id="Map"> | |
<area shape="rect" coords="7,8,38,36" href="http://jsrun.it/assets/9/Q/J/1/9QJ1n.jpg" class="fancybox" /> | |
<area shape="rect" coords="41,6,70,35" href="http://jsrun.it/assets/y/z/4/q/yz4qn.jpg" class="fancybox" /> | |
<area shape="rect" coords="75,6,103,35" href="http://jsrun.it/assets/y/2/t/Q/y2tQB.jpg" class="fancybox" /> | |
</map> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- head内などに下記を記述します --> | |
$(function() { | |
//fancyboxを起動させる記述 | |
$(".fancybox").fancybox({ | |
padding:0, | |
margin:0, | |
//fancyboxが完全に起動し終わった後、画像をくくっているDIVにusemap要素を追記します | |
onComplete: function() { | |
$('#fancybox-img').attr('usemap', '#Map'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment