jquery ui dialog auto width height

Jak
Jak
908 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: 2991
Total Answered: 1
Total Marked As Answer: 0
Posted On: 21-May-2021 23:52

Share:   fb twitter linkedin
Answers
beginer
beginer
1544 Points
52 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