Как прикрепить ко всем событиям открытия Jquery.UI.dialog для динамического изменения размера диалогового окна при открытии?

Я работаю с большой существующей базой кода с тоннами устаревшего кода, который я не могу изменить. Моя задача - перейти на версию UI библиотеки 1.8. У меня проблемы с размещением элемента jquery.ui.dialog ().

Весь сайт загружается через javascript (что, я думаю, сейчас очень популярно). Тонны HTML загружаются динамически, что вызывает проблемы с позиционированием в диалоговом окне. Раньше сайт использовал настраиваемое положение CSS: относительно, чтобы убедиться, что все диалоговые окна расположены правильно.

Диалог ' http://jqueryui.com/docs/Upgrade_Guide/1.8.6

Не менять позицию DOM при открытии

Диалоги больше не перемещаются в DOM, когда они открыты. Единственный время, когда диалог перемещается сейчас, во время инициализация при добавлении к тело. Это исправляет множество проблемы, такие как элементы формы reset, iframes reloading, etc.

All of the dialog() setup code is bound to html elements very early and is in several different places. In a perfect world I'd be able to get in there and change all the dialog calls to be late bound and only setup right before the dialog is supposed to open. This would most likely fix the issue. Unfortunately changing all this code is really prohibitive and defiantly not an option.

What I'm thinking is hooking into the dialog open event http://jqueryui.com/demos/dialog/#event-open and resetting the position right before the modal window actually opens.

So either I can find all the elements with dialogs and then bind via $( ".selector" ).bind( "dialogopen" etc etc or hook into the event globally ( preferred ). Either I need a way to say "give me all the elements with a dialog attached" or "always do this code when the open event happens.

Any ideas?

5
задан John Farrell 15 February 2011 в 17:57
поделиться