2
I have an application ready with its own layout, and within this layout I use the fancybox. Only now I am obliged to migrate to the bootstrap
and I’m using the Adminlte-2.1.1 for fitting in with what I want.
The big question is to migrate the parts with the fancybox for modal. In the fancybox it was only declaring a class and giving options of the size of the iframe
and opened the independent page, as shown below:
$(".detalhes").fancybox({
closeBtn : true,
type: 'iframe',
'autoSize': false,
'width': 600,
'height': 500
});
Link call:
<a class="detalhes fancybox.iframe" href="detalhes.php?id='.$row[7].'" >
<img src="imagens/atualiza.png" border=0 title="Ver detalhes "/>
</a>
Already with the modal of bootstrap
, the page opens from the page itself, as follows::
$(document).on('click', '[data-toggle="meumodal"]', function(event){
event.preventDefault();
target = $(this).attr("data-target");
content = $(this).attr("href");
$(target+".modal .modal-content").load(content,function(){
$(target).modal('show');
});
});
div do modal:
<div class="modal fade" id="myModal" data-toggle="meumodal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
</div>
</div>
</div>
link call:
<a data-toggle="meumodal" href="detalhes.php?id='.$row[7].'" data-target="#myModal" class="btn btn-info" title="Ver detalhes">
<i class="fa fa-file-zip-o"></i>
</a>
div external page:
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Detalhes Requerimento</h4>
</div>
<div class="modal-body">
CONTEÚDO
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">cancelar</button>
</div>
that is, much more work. But regardless of this, I prefer migration, because it would be a very unprofessional job.
There is no other plugin for bootstrap
calling the independent page with the modal layout?
No jquery calls work in modal and are just like in fancybox.
Example:
$(".curso").hide();
$(".local").hide();
$(".orgao").hide();
$('#tipo').on('change', function () {
var valor = this.value;
if(valor == 3){
$(".curso").show();
$(".local").show();
$(".orgao").hide();
}else if(valor == 2){
$(".curso").hide();
$(".local").show();
$(".orgao").hide();
}else{
$(".curso").hide();
$(".local").hide();
$(".orgao").show();
}
});
$(".data").mask("99/99/9999");
i can do this with a dynamic link? because I use the send via get in php a lot. on the myModal.html page I have to call jquery and css?
– opeta
I’m not sure what a "dynamic link" is from your perspective, but I edited the answer to show that you load the libraries in the HEAD of index.html, the myModal.html gets only the content of the modal.
– ShutUpMagda
sorry it took me so I was testing and I was able to make the jquerys work within the modal only the jquery validate that doesn’t work so much that it can help me follow the link in jsfiddle https://jsfiddle.net/opeta/bLsvkeot/
– opeta
Modal windows aren’t exactly "windows". Windows have the ability to load the libraries themselves to the document, but you won’t be able to make a modal load independent libraries (like jquery validate) because it depends on what was declared in the main HTML.
– ShutUpMagda