-
-
Save nextab/48dabe3e1f9005b5268ea2e96132a86f to your computer and use it in GitHub Desktop.
Code-Snippets für ein ausfahrbares Kontaktformular in WordPress (Divi Theme)
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
| body.slide-form-open { | |
| overflow: hidden; | |
| overscroll-behavior: none; | |
| touch-action: none; | |
| } | |
| /* #region Slide In Contact Form */ | |
| .et_pb_section.slide_in_contact_form { | |
| height: 100%; | |
| left: auto; | |
| max-width: 440px; | |
| position: fixed; | |
| right: 0; | |
| top: 0; | |
| transform: translatex(100%); | |
| transition: transform 300ms ease; | |
| width: 100%; | |
| z-index: 99999999999999999999999999999; | |
| } | |
| .et_pb_section.slide_in_contact_form.slide-in-active { | |
| transform: translatex(0%); | |
| } | |
| .button_trigger_row { | |
| left: 0; | |
| position: absolute; | |
| top: 25%; | |
| transform: translatex(-100%); | |
| width: auto; | |
| } | |
| .button_trigger_row.et_pb_column { | |
| align-items: flex-end; | |
| display: flex; | |
| flex-flow: column nowrap; | |
| } | |
| .button_trigger_row.et_pb_column .et_pb_icon { | |
| margin-right: 3px; | |
| } | |
| .button_trigger_row .et_pb_button_module_wrapper { | |
| transform-origin: top right; | |
| transform: rotate(-90deg) translatey(-100%); | |
| } | |
| .button_trigger_row .et_pb_button_module_wrapper .et_pb_button { | |
| background-color: $highlight; | |
| border-radius: 7px 7px 0 0; | |
| border: none; | |
| color: $white; | |
| cursor: pointer; | |
| font-size: 1rem; | |
| letter-spacing: 1px; | |
| padding: 0.5em 1rem 0.4em; | |
| text-transform: uppercase; | |
| transition: all 300ms ease; | |
| } | |
| .button_trigger_row .et_pb_button_module_wrapper .et_pb_button:hover { | |
| background-color: $dark-blue; | |
| color: $white !important; | |
| padding: 0.5em 1rem 0.4em; | |
| } | |
| .button_trigger_row .et_pb_button_module_wrapper .et_pb_button::after { | |
| display: none; | |
| } | |
| /* #endregion Slide In Contact 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
| (function() { | |
| // Slide-in contact form functionality | |
| const slideFormTrigger = document.querySelector('a[href="#slide_form"]'); | |
| const slideFormClose = document.querySelector('a[href="#close_slide_form"]'); | |
| const slideFormSection = document.querySelector('.et_pb_section.slide_in_contact_form'); | |
| const body = document.body; | |
| function toggleSlideForm() { | |
| const isOpening = !slideFormSection.classList.contains('slide-in-active'); | |
| slideFormSection.classList.toggle('slide-in-active'); | |
| body.classList.toggle('slide-form-open'); | |
| if (isOpening) { | |
| // Focus on first .et_pb_blurb element when opening | |
| const firstBlurb = slideFormSection.querySelector('.et_pb_blurb'); | |
| if (firstBlurb) { | |
| firstBlurb.focus(); | |
| } | |
| } | |
| } | |
| function closeSlideForm() { | |
| slideFormSection.classList.remove('slide-in-active'); | |
| body.classList.remove('slide-form-open'); | |
| } | |
| // ESC key to close slide form | |
| document.addEventListener('keydown', function(event) { | |
| if (event.key === 'Escape' && slideFormSection.classList.contains('slide-in-active')) { | |
| closeSlideForm(); | |
| } | |
| }); | |
| if (slideFormTrigger && slideFormSection) { | |
| slideFormTrigger.addEventListener('click', function(event) { | |
| event.preventDefault(); | |
| toggleSlideForm(); | |
| }); | |
| } | |
| if (slideFormClose && slideFormSection) { | |
| slideFormClose.addEventListener('click', function(event) { | |
| event.preventDefault(); | |
| closeSlideForm(); | |
| }); | |
| } | |
| })(); |
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
| body.slide-form-open { | |
| overflow: hidden; | |
| overscroll-behavior: none; | |
| touch-action: none; | |
| } | |
| /* #region Slide In Contact Form */ | |
| .et_pb_section.slide_in_contact_form { | |
| height: 100%; | |
| left: auto; | |
| max-width: 440px; | |
| position: fixed; | |
| right: 0; | |
| top: 0; | |
| transform: translatex(100%); | |
| transition: transform 300ms ease; | |
| width: 100%; | |
| z-index: 99999999999999999999999999999; | |
| &.slide-in-active { | |
| transform: translatex(0%); | |
| } | |
| } | |
| .button_trigger_row { | |
| &.et_pb_row { | |
| left: 0; | |
| position: absolute; | |
| top: 25%; | |
| transform: translatex(-100%); | |
| width: auto; | |
| .et_pb_column { | |
| align-items: flex-end; | |
| display: flex; | |
| flex-flow: column nowrap; | |
| } | |
| } | |
| .et_pb_icon { | |
| margin-right: 3px; | |
| } | |
| .et_pb_button_module_wrapper { | |
| transform-origin: top right; | |
| transform: rotate(-90deg) translatey(-100%); | |
| .et_pb_button { | |
| background-color: $highlight; | |
| border-radius: 7px 7px 0 0; | |
| border: none; | |
| color: $white; | |
| cursor: pointer; | |
| font-size: 1rem; | |
| letter-spacing: 1px; | |
| padding: 0.5em 1rem 0.4em; | |
| text-transform: uppercase; | |
| transition: all 300ms ease; | |
| &:hover { | |
| background-color: $dark-blue; | |
| color: $white !important; | |
| padding: 0.5em 1rem 0.4em; | |
| } | |
| &::after { | |
| display: none; | |
| } | |
| } | |
| } | |
| } | |
| /* #endregion Slide In Contact Form */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment