Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajucs/0cfde6552ce8ae6d463aea2c0830ee57 to your computer and use it in GitHub Desktop.
Save rajucs/0cfde6552ce8ae6d463aea2c0830ee57 to your computer and use it in GitHub Desktop.
// Perform your Ajax call here
$.ajax({
// ... your Ajax settings ...
success: function(response) {
// After the Ajax call is successful and content is loaded
// Scroll to the target div with animation
$("html, body").animate(
{
scrollTop: $("#wps-comment-list").offset().top - 50
},
2000 // Animation duration in milliseconds
);
},
error: function(error) {
// Handle Ajax error
console.error("Ajax call error:", error);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment