JQuery диалог IE7 проблемы - PullRequest
       20

JQuery диалог IE7 проблемы

3 голосов
/ 27 октября 2010

У меня проблемы с шириной заголовка только в IE7. Первая диалоговая функция при открытии с использованием width: 'auto', заголовок не распространяется на все диалоговое окно. Вторая функция, использующая minWidth, работает, но действует больше как свойство width и не увеличивается в размере с содержимым. Есть идеи?

Не работает:

        $(dialogId).dialog({
            autoOpen: 'false',
            modal: true,
            draggable: false,
            resizable: false,
            buttons: buttons,
            title: title,
            width: 'auto',
            open: function(){
                /* IE HACK */
                $buttonPane = $(this).next();
                $buttonPane.find('button:first').addClass('accept').addClass('action');
                $('.ui-dialog-titlebar-close').hide();
                $('.ui-dialog').addClass('open_dialog');
                $(this).css('overflow','hidden');// IE hack
                onOpen;
            },
            close: function(){
                $('.ui-dialog').removeClass('open_dialog');
                afterClose;
            }
        });

Рабочая (только как фиксированная ширина):

        $('#conf_dialog').dialog({
            dialogClass: dialogclass,
            autoOpen: 'false',
            modal: true,
            draggable: false,
            resizable: false,
            buttons:buttons,
            title:title,
            minWidth: 255,
            open: function(){
                /* IE HACK */
                $buttonPane = $(this).next();
                $buttonPane.find('button:first').addClass('accept').addClass('action');
                $('.ui-dialog-titlebar-close').hide();
            },
            close: afterClose
        });

Ответы [ 2 ]

2 голосов
/ 19 августа 2011

Теоретически ширина: авто не поддерживается, но, похоже, работает в IE8 и FF, но не в IE7

Я наткнулся на эту ссылку:

http://ovaraksin.blogspot.com/2011/05/jquery-ui-dialog-with-auto-width-and.html

И адаптировал это так:

       $("#myDialog").dialog({ autoOpen: false,
            width: 'auto',
            height: 'auto',
            modal: true,
            title: 'ABC...' 
        }).bind("dialogopen", function (event, ui) {

            // fix for width:auto in IE  
            var contentWidth = $(this).width();
            $(this).parent().find('.ui-dialog-titlebar').each(function () {
                $(this).width(contentWidth);
            });

        }).bind("dialogclose", function (event, ui) {
            //fix for width:auto in IE 
            $(this).parent().css("width", "auto"); 
        });
1 голос
/ 28 апреля 2011

Что произойдет, если вы вообще не определяете ширину? Вы пробовали ширину: 100%?

...