Javascript 在meteor模板中使用模态
我有modal.html:Javascript 在meteor模板中使用模态,javascript,jquery,twitter-bootstrap,meteor,Javascript,Jquery,Twitter Bootstrap,Meteor,我有modal.html: <template name="modal"> <div class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h2 class="modal-t
<template name="modal">
<div class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title">Dialog</h2>
</div>
<div class="modal-body">
<p>
Dialogs are typically used to prompt users to make a specific decision
as part of or before continuing with a task or process. They can be used
to inform users about a specific issue, to confirm particularly important
actions, or to explain significant ramifications of an action before
allowing the user to proceed.
</p>
</div>
<div class="modal-footer">
<button class="btn btn-flat pull-left">More info...</button>
<button class="btn btn-flat" data-dismiss="modal">Close</button>
<button class="btn btn-flat btn-primary" data-dismiss="modal">Save</button>
</div>
</div>
</div>
</div>
</template>
我有transfer.html和transfer.js
<template name="transfer">
<!-- Somewhere inside template -->
<a href="#" class="btn small-btn btn-fab reminder-btn" id="lock-pay" data-toggle="tooltip" data-placement="right" title="foo"><i class="fa fa-lock"></i></a>
</template>
Template.transfer.events({
'click #lock-pay': function(event) {
event.preventDefault();
$('#modal').modal('show');
}
})
我尝试将模式模板放在与传输相同的文件中,但也不起作用我想您忘记在HTML中的某个位置实际呈现模式模板,请尝试以下操作:
<template name="transfer">
{{> modal}}
<a href="#" class="btn small-btn btn-fab reminder-btn" id="lock-pay" data-toggle="tooltip" data-placement="right" title="foo"><i class="fa fa-lock"></i></a>
</template>
您应该使用数据切换和数据目标来打开模式,而不是自己管理单击事件
<a href="#" data-toggle="modal" data-target="#modal"></a>
请添加模式代码以进一步诊断问题。谢谢!我可以有多个“数据切换”的ie:data toggle=tooltip模式吗?我已经编写了一个软件包,可以方便地使用bootstrap 3模式。请随意选择或。
<a href="#" data-toggle="modal" data-target="#modal"></a>