Alter the commands used on a Views AJAX request.
array $commands: An array of ajax commands.
\Drupal\views\ViewExecutable $view: The view which is requested.
function hook_views_ajax_data_alter(array &$commands, ViewExecutable $view) {
// Replace Views' method for scrolling to the top of the element with your
// custom scrolling method.
foreach ($commands as &$command) {
if ($command['method'] == 'viewsScrollTop') {
$command['method'] .= 'myScrollTop';
}
}
}