Create Beautiful Responsive Photo & Video Galleries For Your Site in Minutes

Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to disable keyboard and mouse wheel navigation

Disabling keyboard and mouse wheel navigation prevents you from using the keyboard or the mouse scroll wheel to change or scroll the gallery image.

With Envira Gallery, you can achieve this using simple code snippets. This guide will show you how!

Heads up!

This article contains PHP, CSS, and/or JavaScript to customize our plugin. We offer this code as a courtesy but don’t provide support for additional code customizations or 3rd party development.

To disable keyboard and mouse wheel navigation, just add the following code to your site.

If you need help adding custom code to your site, please check out our guide on adding custom PHP or JavaScript to your site.

/* Disable Keyboard and Mousewheel Navigation
* 
* @link https://enviragallery.com/docs/how-to-disable-keyboard-and-mousewheel-navigation/
*/

// Disable for Albums
add_filter( 'envira_albums_pre_data', 'my_envira_album_pre_data', 10, 2 );
function my_envira_album_pre_data( $data, $album_id ) {
$data['config']['keyboard'] = 0; // 0 for disable, 1 to enable
$data['config']['mousewheel'] = false; // false for disable, true to enable
return $data;
}

// Disable for Galleries
add_filter( 'envira_gallery_pre_data', 'my_envira_gallery_pre_data', 10, 2 );
function my_envira_gallery_pre_data( $data, $gallery_id ) {
$data['config']['keyboard'] = 0; // 0 for disable, 1 to enable
$data['config']['mousewheel'] = false; // false for disable, true to enable
return $data;
}

After adding the code, check your Envira Gallery to ensure keyboard and mouse wheel navigation are disabled as expected.

Disable Keyboard and Mouse Navigation

That’s it! Would you like to extend Envira further? Check out our tutorial on how to Display Adsense Ads in Lightbox.


The Best Drag and Drop WordPress Gallery Plugin

Envira Gallery: Create, Showcase, and Sell Your Work – Trusted by 150k+ Sites.

Enter the URL of your WordPress website to install

Please enable JavaScript in your browser to complete this form.

Upgrade to Envira Gallery Pro

Unlock even more powerful features designed to make your galleries even more beaituful.

Video Galleries

eCommerce

Social media Sharing

Adobe Lightroom

And much more!

Copyright © [#this year :%Y] Envira Gallery, LLC. Envira Gallery is a trademark of Envira Gallery, LLC.