HI all,

I am getting a synchronization problem when loading an ajax content
via nyro modal - spent a few hours debugging it line-by-line. The
problem is: sometimes, depending on internet connection, the modal
window returns an error (object required) - mainly in IE. I could
click the same link 10 times - rendered OK, and then itgenerates an
error once.

Here is the fragment of the code (narrowed with the debugger)

if (currentSettings.autoSizable && (!currentSettings.width || !
currentSettings.height)) {
                        modal.contentWrapper
                                .css({
                                        opacity: 0,
                                        width: 'auto',
                                        height: 'auto'
                                })
                                .show();
                        var tmp = {
                                width: 'auto',
                                height: 'auto'
                        };
.........

The error happens when IE7 (due to some reasons) does not create the
div contentWrapper first. Than jquery tries to assign css to a non-
existing element.

I have managed to fix it (a very bad way though) by adding a delay of
about 400ms in front of that construction:

        function sleep(delay)
        {
                 var start = new Date().getTime();
                 while (new Date().getTime() < start + delay);
        }

It works okey, but it's not a very good solution, because not linked
to the contentWrapper element creating.

are there any better ways of doing this? In other words, I need a
dynamic delay before the element is created.

any suggestions?

Reply via email to