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
/*/////////////////// | |
JS | |
Build a simple product visualiser with Gravity Forms Color Picker | |
Full article at https://jetsloth.com/labs/build-a-simple-product-visualiser-with-gravity-forms-color-picker/ | |
////////////////////*/ | |
<script type="text/javascript"> | |
jQuery(document).bind('gform_post_render', function(e, formId, currentFormPage) { | |
// Hide all the product images | |
jQuery( ".gform_body li.preview-area img" ).css('display','none'); |
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
<img class=”product” src=”https://yourwebsite.com/link_to_your_image/my_image1.png“/> | |
<img class=”product” src=”https://yourwebsite.com/link_to_your_image/my_image2.png“/> | |
<img class=”product” src=”https://yourwebsite.com/link_to_your_image/my_image3.png“/> | |
<img class=”product” src=”https://yourwebsite.com/link_to_your_image/my_image4.png“/> |
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
/*///////////////////////////////////////*/ | |
/* Outter form wrapper */ | |
.gform_body { | |
background:#f6f6f6; | |
border-radius:10px; | |
margin-bottom:40px; | |
overflow:hidden; | |
padding:50px 0px; | |
} |
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
<script type="text/javascript"> | |
jQuery(document).bind('gform_post_render', function(e, formId, currentFormPage) { | |
var $form = jQuery('#gform_' + formId); | |
$form.find(".gform_body li.preview-area img" ).css('display','none'); | |
$form.find(".gform_body li.preview-area .demo-product:eq(0)" ).css('display','block'); | |
$form.find(".gform_body li.preview-area .demo-artwork:eq(1)" ).css('display','block'); | |
// On color swatch click/secltion | |
$form.find("li.color-picker-choice " ).click(function() { | |
var $radioIndex = $form.find("li.color-picker-choice ").index(this); | |
var $imageRef = $form.find(".gform_body li.preview-area .demo-product"); |
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
<img class="demo-product" src="https://jetsloth.com/wp-content/uploads/2018/09/Artboard-3-Copy-12.png"/> | |
<img class="demo-product" src="https://jetsloth.com/wp-content/uploads/2018/09/Artboard-3-Copy-13.png"/> | |
<img class="demo-product"" src="https://jetsloth.com/wp-content/uploads/2018/09/Artboard-3-Copy-14.png"/> | |
<img class="demo-product" src="https://jetsloth.com/wp-content/uploads/2018/09/Artboard-3-Copy-15.png"/> | |
<img class="demo-artwork" src="https://jetsloth.com/wp-content/uploads/2018/09/I-heart-Jetsloth-1.svg"/> | |
<img class="demo-artwork" src="https://jetsloth.com/wp-content/uploads/2018/09/logo.svg"/> | |
<img class="demo-artwork" src="https://jetsloth.com/wp-content/uploads/2018/09/sloth-logo-royalty-free_defiant-sloth.png"/> | |
<img class="demo-artwork" src="https://jetsloth.com/wp-content/uploads/2019/07/JetSloth-Logo-dark.png"/> |
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
/*/////////////////// | |
JetSloth.com | |
Display your Collapsible Sections in tabs with this CSS updates | |
Full article at https://jetsloth.com/labs/display-your-form-with-tabs-using-collapsible-sections/ | |
////////////////////*/ | |
/* /////////////////// Form wrapper /////////////////// */ | |
.form-has-collapsible-sections_wrapper { | |
margin: 0 auto; | |
text-align: left; |
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
<?php | |
function add_colors_to_taxonomy_choices( $form ) { | |
global $gf_cpt_addon; | |
if ( empty($gf_cpt_addon) ) { | |
return $form; | |
} | |
foreach( $form['fields'] as &$field ) { | |
$taxonomy = $gf_cpt_addon->get_field_taxonomy( $field ); | |
$colorPickerEnabled = ( isset($field['colorPicker_enableColors']) && !empty($field['colorPicker_enableColors']) ); |
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
<?php | |
add_filter( "gppa_input_choices", "gppa_populate_featured_image_choices", 100, 3 ); | |
function gppa_populate_featured_image_choices( $choices, $field, $objects ) { | |
if ( ! property_exists($field, 'imageChoices_enableImages') || ! $field->imageChoices_enableImages ) { | |
return $choices; | |
} | |
$i = 0; |
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
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;700&display=swap'); | |
/*To get the produc options fields working, you need to add a product field. */ | |
/*However we don't want to show that in this example so lets hide it with CSS.*/ | |
.hidden { | |
display: none; | |
visibility: hidden; | |
pointer-events: none; | |
} | |
/*Background Wrapper*/ | |
.gform_wrapper { |
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
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;700&display=swap'); | |
/*To get the produc options fields working, you need to add a product field. */ | |
/*However we don't want to show that in this example so lets hide it with CSS.*/ | |
.hidden { | |
display: none; | |
visibility: hidden; | |
pointer-events: none; | |
} | |
/*Dark field lables*/ | |
.top_label label.gfield_label { |