启动问题,文件上传不在模态内工作
bootstrap issue, "fileupload" not working inside of a modal
所以,我使用的是一个引导模态,模态内部,我想使用图像上传,但是当一个图像被选中时,什么都没有发生,我假设这是一个javascript问题,脚本和css包含在头部的模态之外。
http://jasny.github.com/bootstrap/javascript.html fileupload
有什么建议吗?我想这是一个javascript问题
<?php
if (isset($_SESSION['login']) and !empty($_SESSION['login']) and $_SESSION['rank'] == 3) {
echo '
<!-- Modal -->
<div id="insert_post_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Insert Post</h3>
</div>
<div class="modal-body">
<p>
<form action="insert_post_sql" method="post" enctype="multipart/form-data">
<table border="0">
<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="fileupload-new thumbnail" style="width: 200px; height: 150px;"><img src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&text=no+image" />
</div>
<div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;">
</div>
<div>
<span class="btn btn-file"><span class="fileupload-new">Select image</span>
<span class="fileupload-exists">Change</span><input type="file" /></span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
</div>
</div>
</table>
</form>
</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<input type="submit" button class="btn btn-primary" value="Submit Post">
</div>
</div>
</form>
';
}
?>
尝试使用Document Ready函数,因为Script是在Modal HTML之前加载的
$('document').ready(function(){
$('#insert_post_modal').on('shown', function(){
$('.fileupload').fileupload();
});
});
尝试在显示模式时调用fileupload(即当用户打开它时):
$('#insert_post_modal').on('shown', function(){
$('.fileupload').fileupload();
});
现在还不能测试,很抱歉
$(文档)时(函数(){$image_crop = $('#image_demo').croppie({enableExif:没错,视窗:{宽度:300年,身高:300,类型://圆"广场"},边界:{宽度:400年,身高:400}});
相关文章:
- 模态框无法正常工作
- 使用 Angular 和 UI-bootstrap 对模态事件绑定无法工作的指令
- 使用Vueify和modal.vue主文件作为模态模板时,Vueify模态无法正常工作
- 模态在IE9中不起作用 - 在打开开发人员工具时,它可以正常工作
- Jquery-UI 模态表单无法正常工作
- “模态形式”与轨道上的引导部分工作
- AngularJS模态服务停止工作
- DatePicker在模态内不工作
- 不能得到引导模态与rails 4的工作
- 我正在做一个ajax调用加载内容到模态对话框;它似乎在所有其他浏览器上工作,而不是IE
- 我如何工作周围关闭这个模态
- 与引导模态和余烬工作
- Jquery Featherlight js自定义CSS单选按钮不工作在模态窗口
- UI引导日期选择器弹出不工作与模态和控制器
- 不工作:显示值从jquery-ajax模态
- 右键单击IE F12开发人员工具不能在模态窗口上工作
- 多个模态不能正常工作
- 如何使网格在模态工作
- HTML模态弹出动画不工作第二次
- 如何在Rails中获得基础显示模态工作