好的,这是我的问题:
- 我正在使用 JQuery Lined TextArea plugin
- 我希望文本区域覆盖所有浏览器窗口区域(全宽、全高)
- 我希望即使在调整浏览器窗口大小时行号也能传播。
这是我的 HTML :
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="jquery.min.js"></script>
<script src="jquery-linedtextarea.js"></script>
</head>
<body>
<textarea id="tv">
Some sample text
</textarea>
<script>
$(function() {
$("#tv").linedtextarea();
});
</script>
</body>
</html>
这是我的 CSS :
body
{
margin:0;
padding:0;
}
*:focus {outline:0px none transparent;}
textarea
{
border:0;
margin:0;
width:100%;
height:100%;
font-family:Courier, "Courier New";
font-size:12px;
}
/* Following lines taken directly from Demo */
.linedwrap {
border: 1px solid #c0c0c0;
}
.linedtextarea {
padding: 0px;
margin: 0px;
}
.linedtextarea textarea, .linedwrap .codelines .lineno {
font-size: 10pt;
font-family: monospace;
line-height: normal !important;
}
.linedtextarea textarea {
padding-right:0.3em;
padding-top:0.3em;
border: 0;
}
.linedwrap .lines {
margin-top: 0px;
width: 50px;
float: left;
overflow: hidden;
border-right: 1px solid #c0c0c0;
margin-right: 10px;
background:#DDD;
}
.linedwrap .codelines {
padding-top: 5px;
}
.linedwrap .codelines .lineno {
color:#AAAAAA;
padding-right: 0.5em;
padding-top: 0.0em;
text-align: right;
white-space: nowrap;
}
.linedwrap .codelines .lineselect {
color: red;
}
有什么想法吗?
最佳答案
在您的文件中尝试此 jquery
代码:
<script>
$(function() {
$("#tv").width(window.screen.width);//widht of parent element of textarea
$("#tv").height(window.screen.height);//height of parent element of textarea
$("#tv").linedtextarea(
{selectedLine: 1}
);
});
</script>
关于javascript - JQuery Lined TextArea 调整大小问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14771257/