summaryrefslogtreecommitdiff
path: root/media/js/photos.js
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2011-05-10 11:43:02 -0500
committerluxagraf <sng@luxagraf.net>2011-05-10 11:43:02 -0500
commit65155fe56f0a95d697526e3f0823d4dd2858483e (patch)
tree434af0177fcad1a1923d8ce48766443dca4db936 /media/js/photos.js
parent0518c06f454b0bf7913984e7e9e4e71932757e40 (diff)
compressed and renamed photos.js, compressed natparks.js
Diffstat (limited to 'media/js/photos.js')
-rw-r--r--media/js/photos.js100
1 files changed, 100 insertions, 0 deletions
diff --git a/media/js/photos.js b/media/js/photos.js
new file mode 100644
index 0000000..32e262f
--- /dev/null
+++ b/media/js/photos.js
@@ -0,0 +1,100 @@
+//Utility functions for map info window
+function mapit(latlontitle) {
+ lat = parseFloat(latlontitle.split(',')[0]);
+ lon = parseFloat(latlontitle.split(',')[1]);
+ //title= latlontitle.split(',')[2];
+ elid= latlontitle.split(',')[2];
+ centerCoord = new google.maps.LatLng(lat, lon);
+ var mapitinit;
+ if (mapitinit == true) {
+ mapPanTo();
+ } else {
+ mapInit();
+ }
+
+ function mapInit() {
+ var mapOptions = {
+ zoom: 8,
+ center: centerCoord,
+ disableDefaultUI: true,
+ navigationControl: true,
+ mapTypeId: google.maps.MapTypeId.TERRAIN,
+ navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}
+ };
+ map = new google.maps.Map(document.getElementById("mw-"+elid), mapOptions);
+ var marker = new google.maps.Marker({
+ position: centerCoord,
+ map: map
+ //title: title
+ });
+ mapitinit = true;
+ }
+ function mapPanTo(){
+ var marker = new google.maps.Marker({
+ position: centerCoord,
+ map: map
+ //title: title
+ });
+ map.panTo(centerCoord);
+ }
+}
+
+//########## utility functions to create/remove map container ############
+function create_map(obj) {
+ //find id of this image caption:
+ imgid = obj.title.split(',')[2];
+ //create container divs
+ $('<div class="map-container" id="mc-'+imgid+'">').insertBefore($(obj).parent().parent());
+ //$(obj).parent().parent().parent().prepend('<div class="map-container" id="mc-'+imgid+'">');
+ $('#mc-'+imgid).append('<div class="map-wrapper" id="mw-'+imgid+'">');
+ //deal with the variable height of div.legend
+ $('#mc-'+imgid).css({
+ bottom: function(index, value) {
+ return parseFloat($(obj).parent().parent().height())+20;
+ }
+ });
+
+ mapit(obj.title);
+}
+function remove_map(imgid) {
+ $('#mc-'+imgid).remove();
+}
+
+//############ Document.ready events ##############
+$(document).ready(function(){
+
+ //set up click events for map button
+ $('.map-link').click( function() {
+ imgid = this.title.split(',')[2];
+ if ($('#mc-'+imgid).is(":visible")) {
+ remove_map(imgid);
+ } else {
+ create_map(this);
+ }
+ return false;
+
+ });
+ var $ele = $('#slides').children()
+ var $curr = 0
+ $(document).bind('keydown', function (e) {
+ var code = e.which;
+ switch (code) {
+ case 39:
+ if ($curr <= $ele.size()) {
+ $.scrollTo($ele[$curr], 800 );
+ $curr++
+ }
+ break;
+ case 37:
+ if ($curr > 0) {
+ $curr--
+ var $now = $curr
+ $now--
+ $.scrollTo($ele[$now], 800 );
+ }
+ break;
+ }
+ return;
+ });
+});
+