java - Auto-resize popup window -


i have popup window launched wxl dimension, w = width, , l = length.

the content fits in area few screens. however, in cases (views appear conditionally), window size not big enough , ends showing scrollbar.

the ask here - how can auto-adjust popup window size resizes (based on content), , hence avoid scrollbar in cases.

one crude option max size of possible views can appear within window , (pre)set size of window, i.e., (w+w)x(l+l). however, that's not ideal/preferable since of views not have content in them , awkward larger popup size.

working demo

$(function(){     $(window).resize(function(){     // screen height , width       var maskheight = $(window).height();       var maskwidth = $(window).width();      // calculate values center alignment     var dialogtop =  (maskheight  - $('#dialog-box').height())/2;       var dialogleft = (maskwidth - $('#dialog-box').width())/2;       // assign values overlay , dialog box     $('#dialog-overlay').css({ height:$(document).height(), width:$(document).width() }).show();     $('#dialog-box').css({ top: dialogtop, left: dialogleft, position:"fixed"}).show();     }).resize(); }); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -