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.
$(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
Post a Comment