Skip to content

Commit

Permalink
change the way to write on events ajaxStart and ajaxSuccess to be sur…
Browse files Browse the repository at this point in the history
…e all browsers catch them
  • Loading branch information
Loïc Goyet committed Jun 21, 2017
1 parent de52fa4 commit 295a549
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 295a549

Please sign in to comment.