[英]Can't set jQuery dialog to width < 150px
I cannot seem to set the width on a jQuery dialog to less than 150px. 我似乎无法将jQuery对话框上的宽度设置为小于150像素。 In other words, if I set it to something less, it will still display it at 150px. 换句话说,如果我将其设置为更小的值,它将仍然以150px显示。
The dialog call: 对话框调用:
$('#menu').dialog({modal:false, height:window.innerHeight-20, width:125,dialogClass: "no-close", position: { my: "right bottom", at: "right bottom", of: window }}); $('#menu')。dialog({modal:false,height:window.innerHeight-20,width:125,dialogClass:“ no-close”,position:{my:“ right bottom”,at:“” right bottom “,of:window}});
Full code: 完整代码:
<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script> <script language="javascript"> var menuOpen=false; function toggleFunctionMenu() { if(!menuOpen) { $('#menu').dialog({modal:false, height:window.innerHeight-30, width:125,dialogClass: "no-close", position: { my: "right bottom", at: "right bottom", of: window }}); $('#menuButton').html("Close"); menuOpen=true; } else { $('#menu').dialog("close"); $('#menuButton').html("Open"); menuOpen=false; } } </script> <style type="text/css"> #menu { display: none; background-color: yellow; width:100%; height:100%; border-style:solid; border-width: 1px; border-color:black; } #menuButton { float:right; } </style> </head> <body> <button onclick="toggleFunctionMenu()" id="menuButton">Open</button> <div id="menu"> </div> </body> </html>
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
#menu
{
display: none;
background-color: yellow;
width:100%;
height:100%;
border-style:solid;
border-width: 1px;
border-color:black;
}
#menuButton
{
float:right;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script language="javascript">
var menuOpen=false;
function toggleFunctionMenu()
{
if(!menuOpen)
{
$('#menu').dialog({modal:false, height:window.innerHeight-30, width:'25px',dialogClass: "no-close", position: { my: "right bottom", at: "right bottom", of: window }});
$('#menuButton').html("Close");
menuOpen=true;
}
else
{
$('#menu').dialog("close");
$('#menuButton').html("Open");
menuOpen=false;
}
}
</script>
</head>
<body>
<button onclick="toggleFunctionMenu()" id="menuButton">Open</button>
<div id="menu">
</div>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.