我对模态有一些问题。我搜索了很多,我在data-target="#panel-modal2"
找到了一些类似的问题,其中没有#
,但是我似乎是O.K.有帮助吗?
这是我的HTML:
<div class="btn-group">
<a class="btn btn-red btn-ripple" data-toggle="modal" data-target="#panel-modal2">Transfer</a>
</div><!--.btn-group-->
<div class="modal modal-nutrition fade full-height from-right" id="panel-modal2" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<div class="row">
<div class="col-md-12">
<h4 class="modal-title">Transfer</h4>
</div>
</div>
</div>
<div class="modal-body">
<div class="form-group">
<div class="row">
</div>
<div class="row margin-top-30">
<div class="col-md-3">To:</div>
<div class="col-md-9">
<select class="selectpicker" data-width="100%">
<option>- Select -</option>
</select>
</div>
</div>
<div class="row margin-top-30">
<div class="col-md-3">Date:</div>
<div class="col-md-9">
<div class="control-group">
<div class="controls">
<div class="input-group">
<span class="input-group-addon"><i class="ion-android-calendar"></i></span>
<div class="inputer">
<div class="input-wrapper">
<input type="text" style="width: 200px" name="transferDate" class="form-control bootstrap-daterangepicker-basic" value="03/18/2013" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="note note-info note-left-striped">
</div><!--.note-->
</div><!--.col-md-12-->
</div><!--.row-->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-flat-secondary" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-flat-primary" data-dismiss="modal">Submit</button>
</div>
</div>
</div>
答案 0 :(得分:1)
请添加默认的jquery和boostrap js你的模态弹出窗口可以正常工作。请查看以下代码段以获得更多理解。
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="btn-group">
<a class="btn btn-red btn-ripple" data-toggle="modal" data-target="#panel-modal2">Transfer</a>
</div><!--.btn-group-->
<div class="modal modal-nutrition fade full-height from-right" id="panel-modal2" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<div class="row">
<div class="col-md-12">
<h4 class="modal-title">Transfer</h4>
</div>
</div>
</div>
<div class="modal-body">
<div class="form-group">
<div class="row">
<div class="col-md-3">From:</div>
<div class="col-md-9">Nursery</div>
</div>
<div class="row margin-top-30">
<div class="col-md-3">To:</div>
<div class="col-md-9">
<select class="selectpicker" data-width="100%">
<option>- Select -</option>
<option>Nursery</option>
<option>Toddlers</option>
<option>Other kindergarten</option>
</select>
</div>
</div>
<div class="row margin-top-30">
<div class="col-md-3">Date:</div>
<div class="col-md-9">
<div class="control-group">
<div class="controls">
<div class="input-group">
<span class="input-group-addon"><i class="ion-android-calendar"></i></span>
<div class="inputer">
<div class="input-wrapper">
<input type="text" style="width: 200px" name="transferDate" class="form-control bootstrap-daterangepicker-basic" value="03/18/2013" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="note note-info note-left-striped">
<h4>Active Transfer</h4>
<p>This person will transfer to Nursery on 14.05.2016</p>
<p>If you submit a new transfer the active one will be overwrited.</p>
</div><!--.note-->
</div><!--.col-md-12-->
</div><!--.row-->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-flat-secondary" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-flat-primary" data-dismiss="modal">Submit</button>
</div>
</div>
</div>
答案 1 :(得分:1)
这可能是因为您使用了太旧或太新版本的jquery来引导v3.x.x。检查你的jquery版本(最大值)是否为2.2.4,因为你的代码很好,没有任何问题。
答案 2 :(得分:1)
尝试在脚本标记中添加bootstrap.js。还要在bootstrap.js之前添加jquery.js
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<div class="btn-group">
<a class="btn btn-red btn-ripple" data-toggle="modal" data-target="#panel-modal2">Transfer</a>
</div><!--.btn-group-->
<div class="modal modal-nutrition fade full-height from-right" id="panel-modal2" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<div class="row">
<div class="col-md-12">
<h4 class="modal-title">Transfer</h4>
</div>
</div>
</div>
<div class="modal-body">
<div class="form-group">
<div class="row">
<div class="col-md-3">From:</div>
<div class="col-md-9">Nursery</div>
</div>
<div class="row margin-top-30">
<div class="col-md-3">To:</div>
<div class="col-md-9">
<select class="selectpicker" data-width="100%">
<option>- Select -</option>
<option>Nursery</option>
<option>Toddlers</option>
<option>Other kindergarten</option>
</select>
</div>
</div>
<div class="row margin-top-30">
<div class="col-md-3">Date:</div>
<div class="col-md-9">
<div class="control-group">
<div class="controls">
<div class="input-group">
<span class="input-group-addon"><i class="ion-android-calendar"></i></span>
<div class="inputer">
<div class="input-wrapper">
<input type="text" style="width: 200px" name="transferDate" class="form-control bootstrap-daterangepicker-basic" value="03/18/2013" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="note note-info note-left-striped">
<h4>Active Transfer</h4>
<p>This person will transfer to Nursery on 14.05.2016</p>
<p>If you submit a new transfer the active one will be overwrited.</p>
</div><!--.note-->
</div><!--.col-md-12-->
</div><!--.row-->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-flat-secondary" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-flat-primary" data-dismiss="modal">Submit</button>
</div>
</div>
</div>
答案 3 :(得分:1)
试试这个
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="btn-group">
<a class="btn btn-red btn-ripple" data-toggle="modal" data-target="#panel-modal2">Transfer</a>
</div><!--.btn-group-->
<div class="modal modal-nutrition fade full-height from-right" id="panel-modal2" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<div class="row">
<div class="col-md-12">
<h4 class="modal-title">Transfer</h4>
</div>
</div>
</div>
<div class="modal-body">
<div class="form-group">
<div class="row">
<div class="col-md-3">From:</div>
<div class="col-md-9">Nursery</div>
</div>
<div class="row margin-top-30">
<div class="col-md-3">To:</div>
<div class="col-md-9">
<select class="selectpicker" data-width="100%">
<option>- Select -</option>
<option>Nursery</option>
<option>Toddlers</option>
<option>Other kindergarten</option>
</select>
</div>
</div>
<div class="row margin-top-30">
<div class="col-md-3">Date:</div>
<div class="col-md-9">
<div class="control-group">
<div class="controls">
<div class="input-group">
<span class="input-group-addon"><i class="ion-android-calendar"></i></span>
<div class="inputer">
<div class="input-wrapper">
<input type="text" style="width: 200px" name="transferDate" class="form-control bootstrap-daterangepicker-basic" value="03/18/2013" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="note note-info note-left-striped">
<h4>Active Transfer</h4>
<p>This person will transfer to Nursery on 14.05.2016</p>
<p>If you submit a new transfer the active one will be overwrited.</p>
</div><!--.note-->
</div><!--.col-md-12-->
</div><!--.row-->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-flat-secondary" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-flat-primary" data-dismiss="modal">Submit</button>
</div>
</div>
</div>
&#13;
答案 4 :(得分:0)
对于元素,省略data-target,并改为使用href =“#modalID”;