admin管理员组文章数量:1396778
The Plupload 'Select files' button doesn't work when it's inside a Bootstrap modal.
The problem
The problem seems to exist on Apple devices only such as the iPad and iPhone. I've tested on a Samsung Galaxy S4 Mini running Android 4.2.2 and on a Nexus 7 tablet running Android 4.4.2 and both of those devices work.
Demo
Here's a demo to illustrate the problem (note you'll need to view on a iPad or iPhone in order to see the problem):
JSFIDDLE
Notes
Interestingly, if I move the following mark-up outside of the .modal
element so that the 'Select files' button is visible on the initial page load, then the problem goes away.
<div id="container">
<a id="pickfiles" href="javascript:;">[Select files]</a>
<a id="uploadfiles" href="javascript:;">[Upload files]</a>
</div>
My question
How can I get the 'Select files' button working inside the modal for iPhone and iPad?
The Plupload 'Select files' button doesn't work when it's inside a Bootstrap modal.
The problem
The problem seems to exist on Apple devices only such as the iPad and iPhone. I've tested on a Samsung Galaxy S4 Mini running Android 4.2.2 and on a Nexus 7 tablet running Android 4.4.2 and both of those devices work.
Demo
Here's a demo to illustrate the problem (note you'll need to view on a iPad or iPhone in order to see the problem):
JSFIDDLE
Notes
Interestingly, if I move the following mark-up outside of the .modal
element so that the 'Select files' button is visible on the initial page load, then the problem goes away.
<div id="container">
<a id="pickfiles" href="javascript:;">[Select files]</a>
<a id="uploadfiles" href="javascript:;">[Upload files]</a>
</div>
My question
How can I get the 'Select files' button working inside the modal for iPhone and iPad?
Share Improve this question edited Nov 15, 2014 at 0:14 henrywright asked Nov 12, 2014 at 21:24 henrywrighthenrywright 10.3k25 gold badges97 silver badges153 bronze badges 6- I believe the button would not make any sense on iphone because you dont get access to local filesstem, so there would be nothing to upload – rapsli Commented Nov 13, 2014 at 22:11
- Access to the local file system is possible on iPhone actually. – henrywright Commented Nov 13, 2014 at 22:31
- Right ;) tested the example on plupload. Can you debug this? Maybe in the ios simulator? – rapsli Commented Nov 14, 2014 at 5:48
- Might perhaps be due to the fact that the modal element is initially hidden …? Try initializing the Plupload when the modal contents are made visible (I’m sure bootstrap has a callback function for that or something). – C3roe Commented Nov 15, 2014 at 0:25
-
@CBroe Bootstrap does have this
$('#myModal').on('shown.bs.modal', function (e) { })
which I've tried but I don't think I'm using it right. Can you show me how? – henrywright Commented Nov 15, 2014 at 0:30
1 Answer
Reset to default 8 +50PLupload has issues rendering inside initially hidden elements. You should 'refresh' plupload after the dialog is shown.
Add this code right after uploader.init()
$('#myModal').on('shown.bs.modal', function () {
uploader.refresh();
})
版权声明:本文标题:javascript - Plupload: Select files button doesn't work when it is inside a Bootstrap modal - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744132672a2592249.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论