1, this function is only applicable to the need to automatically fill or narrow the page to the visible area, and only a single subject to change the height of the demand.
varResetcontrol =function(ptask) {var_task = Ptask | |[], _islock=false, Bindevent=function(){ varme = This; $ (window). Bind (' Resize.reset ',function(event) {Fire.call (me); if(_task.length = = 0) {$ (window). Unbind (' Resize.reset ', Arguments.callee); } }); }, Fire=function () { //Current page Visible height var_iheight =math.min (Window.innerheight, document.documentElement.clientHeight),//Overall height of the page_wheight =Math.max (Document.documentElement.clientHeight, Document.documentElement.scrollHeight, Document.body.clientHeight, document.body.scrollHeight),//Overall actual height of the page_bheight =Document.body.offsetHeight, _resetheight= 0; if(_iheight >_bheight) { //Current page Visible height-Overall actual height of the page_resetheight = _iheight-_bheight; } Else { //Current Page Visibility Height-Overall page height_resetheight = _iheight-_wheight; } for(vari = 0,l = _task.length;i < l;i++){ var_h = _task[i][0].offsetheight; _h= (_h + _resetheight) < 200? £ º (_h +_resetheight); _task[i].css ("Height", _h + "px"); } } This. Push =function(pitem) {_task.push (pitem); } This. init =function() {setTimeout (function() {Fire (); Bindevent (); }, 100); } }
JavaScript Implementation page Adaptive reset visible Area height