Home >Web Front-end >HTML Tutorial >Fixed form size_html/css_WEB-ITnose

Fixed form size_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:10:241030browse

Problem:
When I open a form, I drag the form border with the mouse to change its size. When the form size is reduced to a certain value, the form size is fixed and cannot be reduced any further.

Please ask:
How to implement it with js?


Reply to discussion (solution)

<!DOCTYPE HTML><html>	<head>		<meta charset="gb2312" />		<title></title>		<style>				</style>	</head>	<body>		<div id="a"></div>		<div id="b"></div>		<script>			var $ = function(id){				return document.getElementById(id);			};			window.onresize = function(){				$('a').innerHTML =  document.documentElement.clientWidth				$('b').innerHTML =  document.documentElement.clientHeight				var minWidth = 900;				var minHeight = 500;				if( document.documentElement.clientWidth < minWidth && document.documentElement.clientHeight < minHeight ){					window.resizeTo(minWidth, minHeight);				}			}		</script>	</body></html>



The method of window object is not compatible in browsers very good.

Answer from the 1st floor, I tried it, but it doesn’t work. My browser is IE9. Is it a browser problem?

resizeTo only works on pop-up windows

This requirement cannot be met.
You can only ask the body or div to open the page so that scroll bars appear, so that the layout of the page does not change.

window.onresize = function(){    $('a').innerHTML =  document.documentElement.clientWidth    $('b').innerHTML =  document.documentElement.clientHeight    var minWidth = 900;    var minHeight = 500;    if( document.documentElement.clientWidth < minWidth && document.documentElement.clientHeight < minHeight ){        document.body.style.width = minWidth + 'px';        document.body.style.height = minHeight + 'px';    }}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn