Last active
April 4, 2019 13:48
-
-
Save bgwaltney/092cf36d865d940b8629b17992de32af to your computer and use it in GitHub Desktop.
Modal of InstaPayments Form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .embedded-form{ | |
| overflow-x:hidden; | |
| overflow: hidden; | |
| } | |
| .modal { | |
| overflow-x:hidden; | |
| position: fixed; | |
| left: 0; | |
| top: 0; | |
| width: 100%; | |
| height: 100%; | |
| background-color: rgba(0, 0, 0, 0.5); | |
| opacity: 0; | |
| visibility: hidden; | |
| transform: scale(1.1); | |
| transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s; | |
| } | |
| .modal-content { | |
| overflow-x:hidden; | |
| position: absolute; | |
| top: 50%; | |
| left: 50%; | |
| transform: translate(-50%, -50%); | |
| background-color: white; | |
| /*padding: .5rem .5rem;*/ | |
| width: 28rem; | |
| border-radius: 0.5rem; | |
| } | |
| .close-button { | |
| float: right; | |
| width: 1.5rem; | |
| line-height: 1.5rem; | |
| text-align: center; | |
| cursor: pointer; | |
| border-radius: 0.25rem; | |
| background-color: lightgray; | |
| } | |
| .close-button:hover { | |
| background-color: darkgray; | |
| } | |
| .show-modal { | |
| opacity: 1; | |
| visibility: visible; | |
| transform: scale(1.0); | |
| transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <button class="ip-trigger-button" id="5c814b5bf56f4100172c7963" onClick="toggleIpModal(this)">Click here to trigger the modal!</button> | |
| <div class="modal" id="modal-5c814b5bf56f4100172c7963"> | |
| <div class="modal-content"> | |
| <span class="close-button" onClick="closeIpModals()">×</span> | |
| <div> | |
| <iframe | |
| class="embedded-form" | |
| src="https://forms.instapayments.io/signup/immoweb/5c7fc75ab2f3bb00178dd4d8/5c814b5bf56f4100172c7963" | |
| style=" height: 550px; width:100%; border: none; display:block;" | |
| scroll = “none” | |
| > | |
| <p>Your browser does not support iframes.</p> | |
| </iframe> | |
| </div> | |
| </div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function toggleIpModal(element) { | |
| if (isMobileDevice()) { //if it's a mobile device, send to page else show modal | |
| window.location.href = "https://forms.instapayments.io/signup/immoweb/5c7fc75ab2f3bb00178dd4d8/" + element.id; | |
| }else{ | |
| document.getElementById("modal-" + element.id).classList.toggle("show-modal"); | |
| } | |
| } | |
| function closeIpModals(event) { | |
| for (let modal of document.getElementsByClassName("modal")) { | |
| modal.classList.remove("show-modal"); | |
| } | |
| } | |
| function isMobileDevice() { | |
| return (typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment