AntonLV 9 vuotta sitten
vanhempi
sitoutus
923ff2cdf5
1 muutettua tiedostoa jossa 13 lisäystä ja 13 poistoa
  1. 13 13
      inc/js/jquery.dolPopup.js

+ 13 - 13
inc/js/jquery.dolPopup.js

@@ -558,22 +558,22 @@
 
             } else if (o.position == 'centered') {
 
-                $el.position({
-                    of: window,                    
-                    my: 'center center+' + ($el.outerHeight() > $(window).height() ? parseInt(($el.outerHeight() - $(window).height()) / 2) : '0'),
-                    at: 'center center',
-                    collision: 'none none'
-                });
-
-                // attach window resize event
-                $(window).on('resize.popupWindow', function() {
-
-                    $el.position({
-                        of: window,
-                        my: 'center center+' + ($el.outerHeight() > $(window).height() ? parseInt(($el.outerHeight() - $(window).height()) / 2) : '0'),
+            	var oPosition = function(oElement) {
+            		oElement.position({
+                        of: window,                    
+                        my: 'center center+' + (oElement.outerHeight() > $(window).height() ? parseInt((oElement.outerHeight() - $(window).height()) / 2) : '0'),
                         at: 'center center',
                         collision: 'none none'
                     });
+            	};
+
+            	oPosition($el);
+
+                // attach window resize event
+                $(window).on('resize.popupWindow', function() {
+                	oPosition($el);
+                }).on('scroll', function() {
+                	oPosition($el);
                 });
 
             } else if (typeof o.position == 'object') {