Просмотр исходного кода

#1002 Menu popup sometimes is incorrectly positioned

Alex Trofimov 8 лет назад
Родитель
Сommit
6e0819fb6a
1 измененных файлов с 7 добавлено и 4 удалено
  1. 7 4
      inc/js/jquery.dolPopup.js

+ 7 - 4
inc/js/jquery.dolPopup.js

@@ -443,10 +443,13 @@
                 var sUrl = (options.url.indexOf('http://') == 0 || options.url.indexOf('https://') == 0 || options.url.indexOf('/') == 0 ? '' : sUrlRoot) + options.url;
 
                 $('#' + sPopupId).find(options.container).load(sUrl, function () {
-                	if($('#' + sPopupId).find('img').length > 0)
-                		$('#' + sPopupId).find('img').load(fOnLoad);
-                	else
-                		fOnLoad();
+                    var f = function () {
+                    	if($('#' + sPopupId).find('img').length > 0)
+                    		$('#' + sPopupId).find('img').load(fOnLoad);
+                    	else
+                    		fOnLoad();
+                    };
+                    setTimeout(f, 100); // TODO: better way is to check if item is animating before positioning it in the code where popup is positioning
                 });
             }
         });