Javascript 如何使角度模态可调整大小
我有一个显示数据的角度模式Javascript 如何使角度模态可调整大小,javascript,jquery,angularjs,jquery-ui,Javascript,Jquery,Angularjs,Jquery Ui,我有一个显示数据的角度模式 $timeout(function () { var resizeOptions = { handles: 'all'}; $(".modal-dialog").draggable(); $(".modal-dialog").resizable(resizeOptions); }, 0);
$timeout(function () {
var resizeOptions = { handles: 'all'};
$(".modal-dialog").draggable();
$(".modal-dialog").resizable(resizeOptions);
}, 0);
<script type="text/ng-template" id="tablemodal">
<div class="modal-header">
<div class="modal-title">Chart Data</div>
</div>
<div class="modal-body">
<div class="table-responsive" data-pattern="priority-columns" data-focus-btn-icon="fa-asterisk" data-sticky-table-header="true" data-add-display-all-btn="true" data-add-focus-btn="true">
<table cellspacing="0" class="table table-small-font table-bordered table-striped">
<tbody>
<tr>
<th>x</th>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-white" ng-click="close();">Close</button>
</div>
</script>
我想调整它的大小。我使用了jQueryUI,但是Resizeable只能在水平方向上工作,垂直方向上只有jQueryUI手柄移动,模态保持静止
$timeout(function () {
var resizeOptions = { handles: 'all'};
$(".modal-dialog").draggable();
$(".modal-dialog").resizable(resizeOptions);
}, 0);
<script type="text/ng-template" id="tablemodal">
<div class="modal-header">
<div class="modal-title">Chart Data</div>
</div>
<div class="modal-body">
<div class="table-responsive" data-pattern="priority-columns" data-focus-btn-icon="fa-asterisk" data-sticky-table-header="true" data-add-display-all-btn="true" data-add-focus-btn="true">
<table cellspacing="0" class="table table-small-font table-bordered table-striped">
<tbody>
<tr>
<th>x</th>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-white" ng-click="close();">Close</button>
</div>
</script>
我使用模板显示我的模态,如下所示
$timeout(function () {
var resizeOptions = { handles: 'all'};
$(".modal-dialog").draggable();
$(".modal-dialog").resizable(resizeOptions);
}, 0);
<script type="text/ng-template" id="tablemodal">
<div class="modal-header">
<div class="modal-title">Chart Data</div>
</div>
<div class="modal-body">
<div class="table-responsive" data-pattern="priority-columns" data-focus-btn-icon="fa-asterisk" data-sticky-table-header="true" data-add-display-all-btn="true" data-add-focus-btn="true">
<table cellspacing="0" class="table table-small-font table-bordered table-striped">
<tbody>
<tr>
<th>x</th>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-white" ng-click="close();">Close</button>
</div>
</script>
$timeout(函数(){
var resizeOptions={handles:'all'};
$(“.modal dialog”).draggable();
$(“.modal dialog”).resizable(resizeOptions);
}, 0);
图表数据
x
关
我建议,当我们有非常棒的类库时,避免使用自己的modals。这里我解释如何使用ngModal
$timeout(function () {
var resizeOptions = { handles: 'all'};
$(".modal-dialog").draggable();
$(".modal-dialog").resizable(resizeOptions);
}, 0);
<script type="text/ng-template" id="tablemodal">
<div class="modal-header">
<div class="modal-title">Chart Data</div>
</div>
<div class="modal-body">
<div class="table-responsive" data-pattern="priority-columns" data-focus-btn-icon="fa-asterisk" data-sticky-table-header="true" data-add-display-all-btn="true" data-add-focus-btn="true">
<table cellspacing="0" class="table table-small-font table-bordered table-striped">
<tbody>
<tr>
<th>x</th>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-white" ng-click="close();">Close</button>
</div>
</script>
您必须运行以下命令才能安装此
$timeout(function () {
var resizeOptions = { handles: 'all'};
$(".modal-dialog").draggable();
$(".modal-dialog").resizable(resizeOptions);
}, 0);
<script type="text/ng-template" id="tablemodal">
<div class="modal-header">
<div class="modal-title">Chart Data</div>
</div>
<div class="modal-body">
<div class="table-responsive" data-pattern="priority-columns" data-focus-btn-icon="fa-asterisk" data-sticky-table-header="true" data-add-display-all-btn="true" data-add-focus-btn="true">
<table cellspacing="0" class="table table-small-font table-bordered table-striped">
<tbody>
<tr>
<th>x</th>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-white" ng-click="close();">Close</button>
</div>
</script>
bower install ngModal
或者,如果您想将其添加到bower.json文件中,如下所示
$timeout(function () {
var resizeOptions = { handles: 'all'};
$(".modal-dialog").draggable();
$(".modal-dialog").resizable(resizeOptions);
}, 0);
<script type="text/ng-template" id="tablemodal">
<div class="modal-header">
<div class="modal-title">Chart Data</div>
</div>
<div class="modal-body">
<div class="table-responsive" data-pattern="priority-columns" data-focus-btn-icon="fa-asterisk" data-sticky-table-header="true" data-add-display-all-btn="true" data-add-focus-btn="true">
<table cellspacing="0" class="table table-small-font table-bordered table-striped">
<tbody>
<tr>
<th>x</th>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-white" ng-click="close();">Close</button>
</div>
</script>
dependencies: {
"ngModal": "~1.2.0"
}
并在添加到bower.json后运行以下命令
$timeout(function () {
var resizeOptions = { handles: 'all'};
$(".modal-dialog").draggable();
$(".modal-dialog").resizable(resizeOptions);
}, 0);
<script type="text/ng-template" id="tablemodal">
<div class="modal-header">
<div class="modal-title">Chart Data</div>
</div>
<div class="modal-body">
<div class="table-responsive" data-pattern="priority-columns" data-focus-btn-icon="fa-asterisk" data-sticky-table-header="true" data-add-display-all-btn="true" data-add-focus-btn="true">
<table cellspacing="0" class="table table-small-font table-bordered table-striped">
<tbody>
<tr>
<th>x</th>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-white" ng-click="close();">Close</button>
</div>
</script>
npm install
bower install
要使用该库,请添加JS文件和CSS文件,然后在应用程序中包含该模块:
$timeout(function () {
var resizeOptions = { handles: 'all'};
$(".modal-dialog").draggable();
$(".modal-dialog").resizable(resizeOptions);
}, 0);
<script type="text/ng-template" id="tablemodal">
<div class="modal-header">
<div class="modal-title">Chart Data</div>
</div>
<div class="modal-body">
<div class="table-responsive" data-pattern="priority-columns" data-focus-btn-icon="fa-asterisk" data-sticky-table-header="true" data-add-display-all-btn="true" data-add-focus-btn="true">
<table cellspacing="0" class="table table-small-font table-bordered table-striped">
<tbody>
<tr>
<th>x</th>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-white" ng-click="close();">Close</button>
</div>
</script>
app = angular.module("myApp", ["ngModal"])
你这样走很好
$timeout(function () {
var resizeOptions = { handles: 'all'};
$(".modal-dialog").draggable();
$(".modal-dialog").resizable(resizeOptions);
}, 0);
<script type="text/ng-template" id="tablemodal">
<div class="modal-header">
<div class="modal-title">Chart Data</div>
</div>
<div class="modal-body">
<div class="table-responsive" data-pattern="priority-columns" data-focus-btn-icon="fa-asterisk" data-sticky-table-header="true" data-add-display-all-btn="true" data-add-focus-btn="true">
<table cellspacing="0" class="table table-small-font table-bordered table-striped">
<tbody>
<tr>
<th>x</th>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-white" ng-click="close();">Close</button>
</div>
</script>
<modal-dialog show='dialogShown' dialog-title='My Dialog' height='400px' width='75%'>
<p>Dialog content goes in here</p>
</modal-dialog>
对话框内容在这里
$timeout(function () {
var resizeOptions = { handles: 'all'};
$(".modal-dialog").draggable();
$(".modal-dialog").resizable(resizeOptions);
}, 0);
<script type="text/ng-template" id="tablemodal">
<div class="modal-header">
<div class="modal-title">Chart Data</div>
</div>
<div class="modal-body">
<div class="table-responsive" data-pattern="priority-columns" data-focus-btn-icon="fa-asterisk" data-sticky-table-header="true" data-add-display-all-btn="true" data-add-focus-btn="true">
<table cellspacing="0" class="table table-small-font table-bordered table-striped">
<tbody>
<tr>
<th>x</th>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-white" ng-click="close();">Close</button>
</div>
</script>
我注意到模板中的标记已被破坏,您已打开一行,但未使用x将其关闭。你可能想看看放x,这样你的模板才能正确解析-JQueryUI可能不会将你所有的内容都包装起来,然后出错是的,但添加它不会对我的问题做出任何更改。如何使用类似于jquery ui句柄的东西动态调整大小。我的问题类似于下面的plunker,plnkr.co/edit/yzxtWwZQdq94Tagdiswa?p=预览。只能在手柄移动时水平和垂直调整大小。