Created
August 3, 2012 12:15
-
-
Save opi/3247047 to your computer and use it in GitHub Desktop.
Drupal: prevent views_load_more to scroll
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
<?php | |
/** | |
* 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