gfic_lazy_threshold
Description
This Javascript filter can be used to override the IntersectionObserver: threshold option for Image Choices lazy loading
Usage
Applies to all fields.
gform.addFilter( 'gfic_lazy_threshold', function( threshold, formId, currentPage ){
return threshold;
}, 10, 3);
Applies to all fields in a specific form. In this case, form id 5.
gform.addFilter( 'gfic_lazy_threshold_5', function( threshold, formId, currentPage ){
return threshold;
}, 10, 3);
Applies to specific page in a multi-page form. In this case, page 2 in form id 5.
gform.addFilter( 'gfic_lazy_threshold_5_2', function( threshold, formId, currentPage ){
return threshold;
}, 10, 3);
Examples
This example sets the threshold to 0:
gform.addFilter( 'gfic_lazy_threshold', function( threshold, formId, currentPage ){
return 0;
}, 10, 3);
Placement
Your code snippet can be placed in a HTML field on your form (within <script></script>
tags), or in a theme custom JavaScript file, or you could use the free Gravity Forms Code Chest addon by our friends at GravityWiz.
Source Code
This filter is located in the imageChoices.InitLazyLoad
function in js/gf_image_choices.js.