How to modify fancybox lightbox settings

GravityView added fancybox lightbox support in 2.10

You can use the filter to override default GravityView fancybox settings. See a list of all the options available for fancybox. All the settings are possible to override using the gravityview/lightbox/provider/fancybox/settings filter.

gravityview/lightbox/provider/fancybox/settings filter examples

Disable the fancybox toolbar

/**
 * Disables the fancybox toolbar
 * @see https://fancyapps.com/fancybox/3/docs/#options
 * @param array $settings Array of fancybox settings
 * @return array $settings
 */
add_filter( 'gravityview/lightbox/provider/fancybox/settings', function ( $settings ) {
	$settings['toolbar'] = false;
	return $settings;
});

Remove the thumbnails button from fancybox

/**
 * Removes the Thumbnails button from fancybox
 * @see https://fancyapps.com/fancybox/3/docs/#options
 * @param array $settings Array of fancybox settings
 * @return array $settings
 */
add_filter( 'gravityview/lightbox/provider/fancybox/settings', function ( $settings ) {
	$settings['buttons'] = array( 'close' );
	return $settings;
});

Change the animation effect from "fade" to "zoom-in-out"

/**
 * Changes animationEffect fancybox setting from "fade" default to "zoom-in-out"
 * @see https://fancyapps.com/fancybox/3/docs/#options
 * @param array $settings Array of fancybox settings
 * @return array $settings
 */
add_filter( 'gravityview/lightbox/provider/fancybox/settings', function ( $settings ) {
	$settings['animationEffect'] = 'zoom-in-out';
	return $settings;
});

Combine multiple changes at once.

In the previous examples, only one change was being made at a time. You can modify many settings at once.

/**
 * Modify multiple fancybox settings at once!
 * @see https://fancyapps.com/fancybox/3/docs/#options
 * @param array $settings Array of fancybox settings
 * @return array $settings
 */
add_filter( 'gravityview/lightbox/provider/fancybox/settings', function ( $settings ) {
	
	$settings['toolbar'] = false;
	$settings['animationEffect'] = 'zoom-in-out';
	$settings['buttons'] = array( 'close' );

	return $settings;
});
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.