I tried to implement this feature and I had almost achieved it. To try-out, click any preview button in this page, you can see the content cycling through nodes.
I suppose you want to cycle through a list of nodes generated by a View.
Procedure:
I used Views navigation module to preserve the list of nodes generated in a View. It also preserves the order of those nodes in cache.
In script:
(function ($) {
Drupal.behaviors.module = {
attach: function (context, settings) {
//Posts the current position of node and Views-navigation cache ID - on clicking 'next' button
$("body", context).on("click", ".next", function() {
var pos = $(this).attr('data-pos');
var cid = $(this).attr('data-cid');
$.ajax({
type: 'POST',
url: '/navigation',
dataType: 'json',
data: 'pos='+pos+'&cid='+cid+'&dir='+dir+'',
success: DoWhateverWithNextNode
});
});
},
};
})(jQuery);
In module:
//Menu callback for 'navigation'
function get_next_node() {
if($pos = $_POST['pos']) {
module_load_include('inc', 'views_navigation', 'views_navigation');
$result = views_navigation_get_result($_POST['cid']);
$max_index = count($result) - 1;
$pos = ($pos > $max_index) ? 0 : (($pos < 0) ? $max_index : $pos);
if ($nid = $result[$pos]) {
$next_node = node_load($nid);
return drupal_json_output($next_node);
}
}
}
In DoWhateverWithNextNode(data), you are required to increment 'data-pos' for '.next' element by 1. So that you can cycle through nodes.
P.S. This code may not be a working version. I just provided you an overview of my implementation.