jquery ui dialog auto width height

Jak
Jak
Member
858 Points
132 Posts

I'm using jquery ui dialog to show image with few contents:

$("#dvShowContents").dialog({ 
         buttons:
                     [                
                {
                    text: "Cancel",
                    click: function () {
                        $(this).dialog("close");
                    }
                }
            ],
         modal: true,
         title: 'Show some contents',
         width: 100,
         height: 100
    });

I want dialog height and width will be automatically adjustable on the basic of screen size.

Views: 2498
Total Answered: 1
Total Marked As Answer: 0
Posted On: 21-May-2021 23:52

Share:   fb twitter linkedin
Answers
beginer
beginer
Member
1328 Points
43 Posts
         

We can either do not set width/height or assign auto:

$("#dvShowContents").dialog({ 
         buttons:
                     [                
                {
                    text: "Cancel",
                    click: function () {
                        $(this).dialog("close");
                    }
                }
            ],
         modal: true,
         title: 'Show some contents',
         width: 'auto',
         height: 'auto'
    });
$("#dvShowContents").dialog({ 
         buttons:
                     [                
                {
                    text: "Cancel",
                    click: function () {
                        $(this).dialog("close");
                    }
                }
            ],
         modal: true,
         title: 'Show some contents',
    });

 

Posted On: 04-Jun-2021 21:26
 Log In to Chat