jpopup minimum width

Confluence User - 23 Jul, 2018

Hi,

Is there a way to reduce the minimum width below 668px for Jpopup? I want to use 300px but the popup with will resize back to 90% width if I use values under 668px.

 

This is my javascript code to create the popup

    var height = UI.getPopUpHeight("350");
    var width = UI.getPopUpWidth("670");

    JPopup.create("testPopup", "Add Item", width, height);

    JPopup.show("testPopup", "AddOrderItem?embed=true",params,"Add Item", width, height)

 

Thanks

forms;javascript

3


24 Jul, 2018
confluenceUser
confluenceUser

Hi, did you try setting the width without calling the UI.getPopUpWidth function?

24 Jul, 2018
confluenceUser
confluenceUser

Yup, same outcome. 

27 Jul, 2018
confluenceUser
confluenceUser

Hi, i found the getPopupWidth implementation is as below. Then i tested with the following script seem ok.

 

JPopup.show("testPopup", "http://localhost:8080/jw/web/userview/expenseclaim/home/_/a?",{},"Add Item", 670, 300);
getPopUpWidth: function(width) {
       if (width === undefined || width === "") {
           width = "90%";
       }
       var windowWidth = $(window).width();
       var minWidth = 668;
       var maxWidth = windowWidth - 100;
           
       if (isNaN(width) && width.indexOf("%") !== -1) {
           var tempWidth = parseFloat(width.replace("%", ""));
           width = windowWidth * tempWidth / 100;
       }
       
       if (width > maxWidth) {
           width = maxWidth;
       }
       
       if (width < minWidth) {
           width = windowWidth;
       }
       
       return width;
   }
RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print