-
-
Save kovtunos/1fa93459c67eae16ae63bd66aed24431 to your computer and use it in GitHub Desktop.
Prevent views_load_more to scroll #drupal #drupal7 #ajax
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
/** | |
* Implements hook_views_ajax_data_alter() | |
*/ | |
function mymodule_views_ajax_data_alter(&$commands, $view) { | |
// Do not scroll when using views_load_more module | |
if ($view->query->pager->definition['handler'] == 'views_plugin_pager_load_more') { | |
foreach($commands as $k => $command) { | |
if ($command['command'] == 'viewsScrollTop') { | |
// Remove viewsScrollTop command | |
unset($commands[$k]); | |
// Alternatively, you can replace it your own command, by doing | |
// $commands[$k]['command'] = 'myOwnScrollCommand' | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment