Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //declaration de JQUERY en javascript, pas le choix
- const scriptJquery = document.createElement("script");
- scriptJquery.setAttribute("src","https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js");
- document.head.appendChild(scriptJquery);
- //une fois le Jquery chargé, on ajoute le reste en JQUERY
- scriptJquery.onload = function() {
- //Ajouter bootstrap js et css
- $('head').append('<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" type="text/css" />');
- $('head').append('<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" />');
- //insertion des éléments
- $('body').append('<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">Launch demo modal</button>');
- //var modalContent = '<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"><div class="modal-dialog modal-dialog-centered" role="document"><div class="modal-content"><div class="modal-header"><h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button></div><div class="modal-body">texte de la modal</div><div class="modal-footer"><button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button><button type="button" class="btn btn-primary">Save changes</button></div></div></div></div>';
- var modalContent = $.get('http://modal.local/modal.html');
- $('body').append(modalContent);
- // $(document).ready(function() { setTimeout(openModal,3000) });
- };
- function openModal(){
- $('#exampleModalCenter').modal('toggle')
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement