Created
August 17, 2023 04:18
-
-
Save rajucs/0cfde6552ce8ae6d463aea2c0830ee57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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