Skip to content

Instantly share code, notes, and snippets.

@nikhilweee
Created February 24, 2024 20:57
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 nikhilweee/95090490e98f51f3d4227a80de57e848 to your computer and use it in GitHub Desktop.
Save nikhilweee/95090490e98f51f3d4227a80de57e848 to your computer and use it in GitHub Desktop.
Instagram Web Keyboard Shortcuts
document.addEventListener('keydown', function(event) {
// Map the "." key with previous image in post.
if (event.keyCode === 188) {
let backButton = document.querySelector('button[aria-label="Go back"]');
if (backButton) {
backButton.click();
}
}
// Map the "," key with next image in post.
else if (event.keyCode === 190) {
let nextButton = document.querySelector('button[aria-label="Next"]');
if (nextButton) {
nextButton.click();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment