Changeset 772730
- Timestamp:
- 09/15/2013 02:34:49 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wp-photonav/trunk/jquery.photonav.js
r772727 r772730 40 40 }; 41 41 42 /* PhotoNav DOM tree notes43 44 .photonav -> .container -> .content -> .image45 46 .image is wrapped in .content for uniformity with the drag360 mode,47 where the image is assigned as x-repeat background of .content48 49 .container is separate from .photonav, because the .photonav comprises50 two .containers: one for inline view and one for popup/lightbox view51 52 */53 54 42 this.initMove = function(container) { 55 43 var content = container.find('.content'); … … 108 96 // Parse the position parameters 109 97 this.parsePos = function(position, dimage, dcontainer) { 110 if (position == 'center') { 111 result = (dcontainer - dimage) / 2; 112 } else if (position == 'left') { 113 result = (dcontainer - dimage); 114 } else if (position == 'right') { 115 result = 0; 116 } else { 117 result = parseFloat(position); 98 var result; 99 switch (position) { 100 case 'center': 101 result = (dcontainer - dimage) / 2; 102 break; 103 case 'left': 104 case 'top': 105 result = (dcontainer - dimage); 106 break; 107 case 'right': 108 case 'bottom': 109 result = 0; 110 break; 111 default: 112 result = parseFloat(position); 113 break; 118 114 } 119 115 return result; … … 133 129 content.css('top', Math.min(0, (ch - ih)/2)); 134 130 if (callback) callback(container, content, iw, ih, cw, ch); 131 $(window).resize(function() { 132 if ((container.width() != cw) || (container.height() != ch)) { 133 cw = container.width(); ch = container.height(); 134 var pos = content.position(); 135 if (pos.left < cw - iw) content.css('left', cw - iw); 136 if (pos.top < ch - ih) content.css('top', ch - ih); 137 if (callback) callback(container, content, iw, ih, cw, ch); 138 } 139 }); 135 140 if (config.animate == '1') { 136 141 content.each(
Note: See TracChangeset
for help on using the changeset viewer.