Skip to content

Commit

Permalink
Merge pull request #33 from LoicGoyet/master
Browse files Browse the repository at this point in the history
change the way to write on events ajaxStart and ajaxSuccess...
  • Loading branch information
paulandrieux authored Jun 21, 2017
2 parents de52fa4 + 295a549 commit db05746
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Resources/public/js/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ $(document).ready(function() {
/**
* Keep scroll position after replacing content
*/
$(document).ajaxStart(function() {
scrollTop = $(document).scrollTop();
});
$(document).ajaxSuccess(function() {
$(document).scrollTop(scrollTop);
$(document).on({
ajaxStart: function() {
scrollTop = $(document).scrollTop();
},
ajaxSuccess: function() {
$(document).scrollTop(scrollTop);
}
});

$(document).ajaxComplete(function() {
Expand Down

0 comments on commit db05746

Please sign in to comment.