Using jquery ui draggable
plugin, I've made html text box draggable in this way:
使用jquery ui draggable插件,我已经以这种方式使html文本框可拖动:
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#Text1").draggable({
containment: "parent",
cancel: null
});
});
</script>
<form id="form1" runat="server">
<div>
<div id="dialog" title="Dialog Box" style="border: solid 1px black;">
<input id="Text1" type="text" style="width: 200px; height: 20px;" value="Text1" />
</div>
</div>
</form>
But, how to make it resizable using jQuery as well?
但是,如何使用jQuery使其可调整大小?
Thank you in advance.
先谢谢你。
Goran
2 个解决方案
#1
4
Here is the DEMO to make the HTML textbox resizable
and draggable
using jquery-ui
这是使用jquery-ui使HTML文本框可调整大小和可拖动的演示
HTML:
<div id="container" class="ui-widget-content">
<h3 class="ui-widget-header">Containment</h3>
<span id="draggable">*
<input type="text "id="resizable" class="ui-state-active" value="This is input box">
</span>
</div>
JS:
$(function() {
$( "#resizable" ).resizable({
containment: "#container"
});
$( "#draggable" ).draggable({containment: "#container"});
});
#2
2
By using jQuery UI
.
HTML FILE<input type="text" id="resizable" />
JavaScript File reference all needed jQuery files in script tag i.e
通过使用jQuery UI。 HTML FILE JavaScript文件引用脚本标签中所有需要的jQuery文件,即
<script src="*all needed .js files*"></script>
<script>
$(function() {
$( "#resizable" ).resizable();
});
</script>
by the way why u need to make textbox resizable
顺便说一句,为什么你需要使文本框可调整大小
#1
4
Here is the DEMO to make the HTML textbox resizable
and draggable
using jquery-ui
这是使用jquery-ui使HTML文本框可调整大小和可拖动的演示
HTML:
<div id="container" class="ui-widget-content">
<h3 class="ui-widget-header">Containment</h3>
<span id="draggable">*
<input type="text "id="resizable" class="ui-state-active" value="This is input box">
</span>
</div>
JS:
$(function() {
$( "#resizable" ).resizable({
containment: "#container"
});
$( "#draggable" ).draggable({containment: "#container"});
});
#2
2
By using jQuery UI
.
HTML FILE<input type="text" id="resizable" />
JavaScript File reference all needed jQuery files in script tag i.e
通过使用jQuery UI。 HTML FILE JavaScript文件引用脚本标签中所有需要的jQuery文件,即
<script src="*all needed .js files*"></script>
<script>
$(function() {
$( "#resizable" ).resizable();
});
</script>
by the way why u need to make textbox resizable
顺便说一句,为什么你需要使文本框可调整大小