admin管理员组文章数量:1325594
I have a modal created using Twitter Bootstrap. I want to open using javascript. Right now I have the following:
<script type="text/javascript" id="js">$(document).ready(function() {
$("#my-modal").modal('show')
});
</script>
However, I want to include the backdrop and keyboard attributes as well. Twitter's documentation show the options as:
$('#my-modal').modal({
keyboard: true
})
$('#my-modal').modal({
backdrop: true
})
Using any bination of the three options does not work. I'm not very good with javascript so I don't know what's going on. I'm reading javascript tutorials right now to see where I went wrong, but so far no luck.
Twitter Bootstrap's modal documentation
Thanks.
I have a modal created using Twitter Bootstrap. I want to open using javascript. Right now I have the following:
<script type="text/javascript" id="js">$(document).ready(function() {
$("#my-modal").modal('show')
});
</script>
However, I want to include the backdrop and keyboard attributes as well. Twitter's documentation show the options as:
$('#my-modal').modal({
keyboard: true
})
$('#my-modal').modal({
backdrop: true
})
Using any bination of the three options does not work. I'm not very good with javascript so I don't know what's going on. I'm reading javascript tutorials right now to see where I went wrong, but so far no luck.
Twitter Bootstrap's modal documentation
Thanks.
Share Improve this question edited Nov 19, 2011 at 21:46 crftr 8,5464 gold badges36 silver badges45 bronze badges asked Oct 29, 2011 at 7:01 Jonathan OngJonathan Ong 20.4k18 gold badges82 silver badges118 bronze badges1 Answer
Reset to default 8I'm not familiar with Twitter Bootstrap, but from a quick glance at the reference you linked to it looks like .modal()
method is taking an object to specify parameters so to specify multiple parameters you should be able to do this:
$('#my-modal').modal({
show : true,
keyboard : true,
backdrop : true
});
The bit in the curly brackets {}
is standard JavaScript object literal syntax, where you can specify multiple properties separated by mas.
本文标签: How do I specify multiple javascript modal parameters with Twitter BootstrapStack Overflow
版权声明:本文标题:How do I specify multiple javascript modal parameters with Twitter Bootstrap? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742190344a2430095.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论