#2175·PhotoSwipe

Add option to animate slides when navigating

Author: amartiniCreated Feb 23, 2026Updated Feb 23, 2026

Hey guys, inspecting the code I found that if I change

  goTo(index) {
    this.mainScroll.moveIndexBy(this.getLoopedIndex(index) - this.potentialIndex);
  }

to

  goTo(index) {
    this.mainScroll.moveIndexBy(this.getLoopedIndex(index) - this.potentialIndex, true);
  }

When i click the next/forward button or when I use the keyboard left/right arrow, the slide animate to the next image instead of instantly replacing it. There could be an option to enable that, all you have to do is set the default value of moveIndexBy second parameter (animate).

Thanks for the great work!