Template:TapToLoadMap

From Good Creations! MC Wiki
Jump to navigation Jump to search
   <button onclick="loadIFrame(this)" data-url="{{{1}}}">Tap to Load Map</button>

<script> function loadIFrame(button) {

   var container = button.nextElementSibling; // Selects the next div (iframeContainer)
   var url = button.getAttribute("data-url"); // Gets URL from button attribute
   // Hide button
   button.style.display = "none";
   // Insert iframe dynamically
   container.innerHTML = '<iframe src="' + url + '" height="300" width="100%" style="border: none;"></iframe>';
   container.style.display = "block";

} </script>