Skip to content

Instantly share code, notes, and snippets.

@apsolut
Last active March 31, 2017 11:53
Show Gist options
  • Save apsolut/48f709cc8ec2faf4e6f4a87d752ee1ae to your computer and use it in GitHub Desktop.
Save apsolut/48f709cc8ec2faf4e6f4a87d752ee1ae to your computer and use it in GitHub Desktop.
closed contact form on post page - show only button (toggle form)
/*---------- Post form ----------*/
.job-contact-form {
@include span-columns(24);
@include omega();
@include row();
margin-top: $np;
padding-top: $np;
margin-bottom: $np;
padding-bottom: $np;
border-top: 1px solid lighten($gray, 60%);
.inside {
max-width: 65em;
text-align: center;
margin: 0 auto;
.caldera-grid {
text-align: left;
}
}
.job-form-form {
@include span-columns(24);
@include omega();
margin-top: $np;
}
.cf-uploader-trigger {
width: auto !important;
}
.last_row {
text-align: center !important;
}
input[type="submit"] {
padding: $dp $np*2;
font-weight: bold;
}
.job-form-title {
padding-top: $dp;
padding-bottom: $dp;
}
.job-form-button {
outline: none;
border-radius: 0;
}
.job-form-form {
display: none;
}
&.opened {
.job-form-button {
background: $gray;
color: $white;
}
}
}
/*---------- Open Kontakt Form ----------*/
$('#open-form-button').click(function(e){
$('.job-contact-form').toggleClass('opened');
$('body').toggleClass('form-opened');
e.preventDefault();
$( "#job-form-form" ).slideToggle( "slow", function() {
// Animation complete.
});
});
<?php if( get_field('show_form') ) : ?>
<section id="job-contact-form" class="kontakt job-contact-form">
<div class="inside">
<div class="contact-holder">
<button id="open-form-button" class="job-form-button button-mls center white large">
<?php _e('OPEN FORM.', DECOMTHEME_TRANSLATION); ?><
</button>
<?php if( get_field('insert_form_shortcode','option') ): ?>
<div class="job-form-form" id="job-form-form">
<?php the_field( 'insert_form_shortcode', 'option' ); ?>
</div>
<?php endif; ?>
</div>
</div>
</section>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment