/* * THIS IS OVERRIDE OF AJAX_VIEW.JS WHICH IS A PART OF VIEWS MODULE */ (function ($) { Drupal.ajax.prototype.commands.viewsScrollTop = function (ajax, response, status) { // Scroll to the top of the view. This will allow users // to browse newly loaded content after e.g. clicking a pager // link. var offset = $(response.selector).offset(); // We can't guarantee that the scrollable object should be // the body, as the view could be embedded in something // more complex such as a modal popup. Recurse up the DOM // and scroll the first element that has a non-zero top. var scrollTarget = response.selector; while ($(scrollTarget).scrollTop() == 0 && $(scrollTarget).parent()) { scrollTarget = $(scrollTarget).parent(); } // Only scroll upward if (offset.top - 10 < $(scrollTarget).scrollTop()) { /* SCROLL DISABLED, IN PRACTICE IT DOESN'T WORK FOR AJAX pagination */ //$(scrollTarget).animate({scrollTop: (offset.top - 10)}, 500); } }; })(jQuery);