Advertisement
nicolas-chuet

script.js

Mar 26th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. //declaration de JQUERY en javascript, pas le choix
  2. const scriptJquery = document.createElement("script");
  3. scriptJquery.setAttribute("src","https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js");
  4. document.head.appendChild(scriptJquery);
  5.  
  6. //une fois le Jquery chargé, on ajoute le reste en JQUERY
  7. scriptJquery.onload = function() {
  8.  
  9. //Ajouter bootstrap js et css
  10. $('head').append('<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" type="text/css" />');
  11. $('head').append('<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" />');
  12.  
  13. //insertion des éléments
  14. $('body').append('<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">Launch demo modal</button>');
  15.  
  16. //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">&times;</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>';
  17.  
  18. var modalContent = $.get('http://modal.local/modal.html');
  19. $('body').append(modalContent);
  20.  
  21. // $(document).ready(function() { setTimeout(openModal,3000) });
  22.  
  23. };
  24.  
  25. function openModal(){
  26. $('#exampleModalCenter').modal('toggle')
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement