在javascript中创建一个用于注释的模型窗口

Create a model window for comment in javascript

本文关键字:用于 一个 注释 窗口 模型 javascript 创建      更新时间:2023-09-26

我创建了一个评论按钮。我希望当用户单击按钮时,模型窗口将打开。模型窗口应包含用于编写注释的键盘。

这可能会对你有所帮助。我们无法为您编写整个键盘代码。

.HTML:

<input type="button" value="Show the keyboard!"> <!-- the button -->
<div id="wrapper"> <!-- the keyboard -->
<!-- type your code here, make sure that it's css is like the textarea below, display:none;. Then copy-paste the jquery line which says 'textarea', and change 'textarea' to whatever element you added. -->
<textarea></textarea>
</div>

.CSS:

#wrapper {
    position:relative;
    margin-top:30px;
    background-color:#CCC;
    width:400px;
    height:0px;
}
textarea {
    display:none;
    margin:0 auto;
    width:200px;
    height:160px;
}

j查询:

$(document).ready(function() {
   $('input').click(function() { // when the button is clicked...
        $('#wrapper').animate({ height: '+=200px'},100);
        // ...increase the height of the wrapper by 200px
        $('textarea').css({ 'display': 'block'});
        // ...make sure that the textarea is visible
   })
});

链接到JSFiddle:http://jsfiddle.net/16fuhf6r/3/包括带有代码解释的注释。