comparison client/digitallibrary/jquery/jquery.digilib.js @ 726:6224f64cbd58 jquery

fixed birdZoomDiv positioning in embedded mode
author robcast
date Tue, 01 Feb 2011 00:12:02 +0100
parents 936d88972cd0
children fc61c6b02c78
comparison
equal deleted inserted replaced
725:936d88972cd0 726:6224f64cbd58
333 data.settings.isAboutDivVisible = showDiv(data.settings.isAboutDivVisible, data.$aboutDiv, show); 333 data.settings.isAboutDivVisible = showDiv(data.settings.isAboutDivVisible, data.$aboutDiv, show);
334 }, 334 },
335 335
336 // event handler: toggles the visibility of the bird's eye window 336 // event handler: toggles the visibility of the bird's eye window
337 showBirdDiv : function (data, show) { 337 showBirdDiv : function (data, show) {
338 var settings = data.settings;
338 if (data.$birdDiv == null) { 339 if (data.$birdDiv == null) {
339 // no bird div -> create 340 // no bird div -> create
340 setupBirdDiv(data); 341 setupBirdDiv(data);
341 } 342 }
342 data.settings.isBirdDivVisible = showDiv(data.settings.isBirdDivVisible, data.$birdDiv, show); 343 settings.isBirdDivVisible = showDiv(settings.isBirdDivVisible, data.$birdDiv, show);
344 updateBirdDiv(data);
343 storeOptions(data); 345 storeOptions(data);
344 // data.$birdImg.triggerHandler('load'); // TODO: we shouldn't do that 346 // data.$birdImg.triggerHandler('load'); // TODO: we shouldn't do that
345 }, 347 },
346 348
347 // goto given page nr (+/-: relative) 349 // goto given page nr (+/-: relative)
786 window.location = url; 788 window.location = url;
787 } else { 789 } else {
788 // embedded mode -- just change img src 790 // embedded mode -- just change img src
789 var url = getScalerUrl(data); 791 var url = getScalerUrl(data);
790 data.$img.attr('src', url); 792 data.$img.attr('src', url);
791 // load new bird img (in case the scalerUrl has changed, like in gotopage) 793 // redisplay bird img
792 //showBirdDiv(data); //TODO: change url explicitly 794 updateBirdDiv(data);
793 } 795 }
794 }; 796 };
795 797
796 // returns maximum size for scaler img in fullscreen mode 798 // returns maximum size for scaler img in fullscreen mode
797 var getFullscreenImgSize = function($elem) { 799 var getFullscreenImgSize = function($elem) {
932 var setupBirdDiv = function (data) { 934 var setupBirdDiv = function (data) {
933 var $elem = data.$elem; 935 var $elem = data.$elem;
934 // the bird's eye div 936 // the bird's eye div
935 var $birdDiv = $('<div class="birdview" style="display:none"/>'); 937 var $birdDiv = $('<div class="birdview" style="display:none"/>');
936 // the detail indicator frame 938 // the detail indicator frame
937 var $birdZoom = $('<div class="birdZoom" style="display:none; position:absolute; background-color:transparent;"/>'); 939 var $birdZoom = $('<div class="birdzoom" style="display:none; background-color:transparent;"/>');
938 // the small image 940 // the small image
939 var $birdImg = $('<img class="birdimg"/>'); 941 var $birdImg = $('<img class="birdimg"/>');
940 data.$birdDiv = $birdDiv; 942 data.$birdDiv = $birdDiv;
941 data.$birdZoom = $birdZoom; 943 data.$birdZoom = $birdZoom;
942 data.$birdImg = $birdImg; 944 data.$birdImg = $birdImg;
1152 $birdZoom.width(coords.width); 1154 $birdZoom.width(coords.width);
1153 $birdZoom.height(coords.height); 1155 $birdZoom.height(coords.height);
1154 $birdZoom.offset(coords); 1156 $birdZoom.offset(coords);
1155 } else { 1157 } else {
1156 // nice animation for embedded mode :-) 1158 // nice animation for embedded mode :-)
1159 var ppos = $birdZoom.offsetParent().offset();
1160 // correct offsetParent because animate is relative
1161 coords.left = (coords.left - ppos.left) + 'px' ;
1162 coords.top = (coords.top - ppos.top) + 'px';
1157 $birdZoom.animate(coords); 1163 $birdZoom.animate(coords);
1158 } 1164 }
1159 }; 1165 };
1160 1166
1161 // zooms by the given factor 1167 // zooms by the given factor