【发布时间】:2017-11-29 00:08:04
【问题描述】:
当我单击按钮时,我遇到了引导模式背景的问题,模式显示已启动,我创建了一个函数,当我在选择标签上选择某些内容时将附加该函数,因此模式本身将调整大小,但背景仍然是同样的,当我滚动时会留下一个空间..
这是我的模态
<div class="modal fade" id="accounting" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Create Transaction</h4>
</div>
<div class="modal-body">
<form role="form" id="form-transaction">
<div class="form-group col-sm-12">
<label for="transact_2" class="col-sm-12">Transaction</label>
<div class="col-sm-12">
<select class="form-control" id="entry_2" name="entry_2">
<option selected="true" disabled="">Select Entry</option>
<option value="credit">Credit</option>
<option value="debit">Debit</option>
</select>
</div>
</div>
<div id="cash_receiver">
</div>
<div class="form-group">
<button data-dismiss="modal" class="btn btn-default" type="button">Close</button>
<button class="btn btn-success" type="submit">Save changes</button>
</div>
</form>
</div>
</div>
</div>
</div>
这是我根据所选数据附加输入框的脚本
$(document).on('change', '#entry_2', function(){
entry_2= $(this).val();
if(entry_2== 'cash'){
$('#accounting').find('#cash_receiver').addClass('form-group col-sm-12');
$('#accounting').find('#cash_receiver').html('<label for="manager-2" class="col-sm-12">Name of Receiver</label>'+
'<div class="col-sm-12">'+
'<input type="text" class="form-control" id="receiver_2" name="receiver_2" placeholder="Name of Receiver">'+
'<p class="help-block"></p>'+
'</div>');
}else{
$('#accounting').find('#cash_receiver').addClass('form-group col-sm-12');
$('#accounting').find('#cash_receiver').html('<label for="manager-2" class="col-sm-12">Name of Bank</label>'+
'<div class="col-sm-12">'+
'<input type="text" class="form-control" id="receiver_2" name="receiver_2" placeholder="Name of Bank">'+
'<p class="help-block"></p>'+
'</div>');
}
});
正如您在图像上看到的那样,添加输入框时会发生什么......当我向下滚动时,背景保持静止......我之前使用了data-backdrop=false,发生的事情是背景不透明度丢失。有没有办法在模态调整大小时自动填充背景?..
【问题讨论】:
-
你能提供一个小提琴吗
标签: javascript jquery html css twitter-bootstrap