[英]bootstrap 3: dynamic modal box
I work with bootstrap 3.0 modal box for show/add image url into input box after click in dynamic image link and choose image from iframe modal box(image manager). 在单击动态图像链接并从iframe模态框(图像管理器)中选择图像后,我使用bootstrap 3.0模态框来显示/将图像URL添加到输入框。
PHP/HTML : PHP / HTML:
<div class="filesmap">
<input id="video-12" class="form-control" type="text" name="video[]" value="'.$url.'">
</div> <span class="filesicon"><a id="video-12" data-target="#myModal" href="#" data-toggle="modal" type="button"><i class="mce-ico mce-i-browse"></i></a></span>
<div class="filesmap">
<input id="video-90" class="form-control" type="text" name="video[]" value="'.$url.'">
</div> <span class="filesicon"><a id="video-90" data-target="#myModal" href="#" data-toggle="modal" type="button"><i class="mce-ico mce-i-browse"></i></a></span>
<div class="filesmap">
<input id="video-80" class="form-control" type="text" name="video[]" value="'.$url.'">
</div> <span class="filesicon"><a id="video-80" data-target="#myModal" href="#" data-toggle="modal" type="button"><i class="mce-ico mce-i-browse"></i></a></span>
In modal box(static) : 在模态框(静态)中:
<div class="modal fade" id="myModal">
<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">Modal title</h4>
</div>
<div class="modal-body" style="padding:0px; margin:0px width: 560px;">
<iframe width="560" height="400" src="/dialog.php?type=0&fldr=&field_id=video&&akey=dsflFWR9u2xQa" frameborder="0" style="overflow: scroll; overflow-x: hidden; overflow-y: scroll; "></iframe>
</div>
</div>
</div>
</div>
NOW, for add image url from modal box to input box I add dynamic id for input box(example : id="video-90"
) and sync with field_id
(iframe src). 现在,要将图像网址从模式框添加到输入框,我为输入框添加动态ID(例如:
id="video-90"
),并与field_id
(iframe src)同步。
I need to open modal box for each input box with dynamic iframe/src link like this: 我需要为每个具有动态iframe / src链接的输入框打开模式框,如下所示:
src="/dialog.php?type=0&fldr=&field_id=video-12&&akey=dsflFWR9u2xQa"
src="/dialog.php?type=0&fldr=&field_id=video-90&&akey=dsflFWR9u2xQa"
src="/dialog.php?type=0&fldr=&field_id=video-80&&akey=dsflFWR9u2xQa"
my mean is after click link modal open for same video id (iframe src). 我的意思是针对相同的视频ID(iframe src)打开点击链接模式后。
How to can I create this ? 我该如何创建呢?
i don't know if i understood your question right but if you mean that all the modals contain the same content try this solution it worked for me 我不知道我是否正确理解了您的问题,但是如果您的意思是所有模态都包含相同的内容,请尝试这种对我有用的解决方案
1- the ids for each modal should be different example 1-每个模态的ID应该是不同的示例
<div class="modal fade" id="myModal-'different-id'">
...
</div>
2- this also should be reflected on the data-target within your that triggers the modal 2-这也应该反映在您触发触发模式的数据目标中
data-target="#myModal-'different-id'"
3- i also suggest triggering the modal using this jquery function * 3-我也建议使用此jQuery函数触发模式*
$(function () { $("[data-toggle='modal']").modal();});
if the modal is active without triggering use this function instead 如果模态处于活动状态而没有触发,请改用此功能
$(function () { $("[data-toggle='modal']").modal("hide");}); $(function(){$(“ [data-toggle ='modal']”)。modal(“ hide”);});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.