i modified views_load_more module and create a custom ajax command:
Drupal.ajax.prototype.commands.custom_views_ajax_command = function(ajax, response, status) {
//append new content has been loaded to old (scroll auto load: slimScroll + waypoints)
};
and this's my behaviors:
Drupal.behaviors.cva_autoLoad = {
attach: function(context, settings) {
$.each(Drupal.settings.cva_autoLoad, function(i, st) {
//if scroll down to last row: $(views li.pager-next a).click();
}
}
everythings work fine, but i dont know how to trigger the next link click event if height of views is shortern than window.height()
when views is initial, if its height is shortern than scroll bound height, i want to trigger ajax load automatically
i tried this, but no luck
if(/*this height < window height*/)
$(next_link).click();
even without condition, nothing happens
i call drupal_add_js in function render($input) (views_plugin_pager)
how to fix this? or does anyone have any better ways?
sorry about my urgly english
EDIT
maybe my question is so stupid. if yes, plz let me know.
i really need help
i found this when read ajax drupal core and views:
var setting = Drupal.settings.views.ajaxViews['views_dom_id:'+st.view_dom];
setting.page = 1;
$.ajax({
url: Drupal.settings.views.ajax_path,
type:'POST',
data: setting,
dataType: "json",
success: function(response) {
console.log(response);
/*call Drupal.ajax.commands here ( it should be custom_views_ajax_command above*/
},
});
does anyone know how to call Drupal commands or some ways are more legal?