| 1 |
/* |
| 2 |
* Google Maps Widget |
| 3 |
* (c) Web factory Ltd, 2012 - 2015 |
| 4 |
*/ |
| 5 |
|
| 6 |
jQuery(function($) { |
| 7 |
$('a.gmw-thumbnail-map.gmw-lightbox-enabled').click(function(e) { |
| 8 |
e.preventDefault(); |
| 9 |
|
| 10 |
dialog = $($(this).attr('href')); |
| 11 |
map_width = dialog.attr('data-map-width'); |
| 12 |
map_height = dialog.attr('data-map-height'); |
| 13 |
map_url = dialog.attr('data-map-iframe-url'); |
| 14 |
map_title = dialog.attr('title'); |
| 15 |
map_skin = dialog.attr('data-map-skin'); |
| 16 |
|
| 17 |
// adjust map size if screen is too small |
| 18 |
screen_width = $(window).width() - 50; |
| 19 |
if (screen_width < map_width) { |
| 20 |
map_width = screen_width; |
| 21 |
map_height *= screen_width / map_width; |
| 22 |
} |
| 23 |
screen_height = $(window).height() - 50; |
| 24 |
if (screen_height < map_height) { |
| 25 |
map_height = screen_height; |
| 26 |
map_width *= screen_height / map_height; |
| 27 |
} |
| 28 |
|
| 29 |
content = $(dialog.html()); |
| 30 |
content.filter('.gmw-map').html('<iframe width="' + map_width + 'px" height="' + map_height + 'px" src="' + map_url + '"></iframe>'); |
| 31 |
|
| 32 |
$.colorbox({ html: content, |
| 33 |
title: map_title, |
| 34 |
className: 'gmw-' + map_skin, |
| 35 |
closeButton: false }); |
| 36 |
|
| 37 |
return false; |
| 38 |
}); |
| 39 |
}); // onload |