سؤال

أواجه مشكلة في عرض شريط العنوان في IE7 فقط. وظيفة مربع الحوار الأولى عند فتحها باستخدام العرض: "Auto" لا يمتد شريط العنوان عبر نافذة الحوار بأكملها. تعمل الوظيفة الثانية باستخدام Minwidth ولكنها تتصرف أشبه بخاصية العرض ولا تنمو في الحجم مع المحتوى. أيه أفكار؟

لا يعمل:

        $(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
        });
هل كانت مفيدة؟

المحلول

من الناحية النظرية: لا يتم دعم السيارات ، ولكن يبدو أنه يعمل في 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"); 
        });

نصائح أخرى

ماذا يحدث إذا لم تحدد العرض على الإطلاق؟ هل حاولت العرض: 100 ٪؟

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top