Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
select(index, reposition) {
if(index !== this.activeIndex) {
let oldPanel = this.panels[this.activeIndex],
newPanel = this.panels[index];
DomHandler.fadeIn(newPanel, this.effectDuration);
if(this.showFilmstrip) {
let oldFrame = this.frames[this.activeIndex],
newFrame = this.frames[index];
if(reposition === undefined || reposition === true) {
let frameLeft = newFrame.offsetLeft,
stepFactor = this.frameWidth + parseInt(getComputedStyle(newFrame)['margin-right'], 10),
stripLeft = this.strip.offsetLeft,
frameViewportLeft = frameLeft + stripLeft,
frameViewportRight = frameViewportLeft + this.frameWidth;
if(frameViewportRight > DomHandler.width(this.stripWrapper))
this.stripLeft -= stepFactor;
else if(frameViewportLeft < 0)
this.stripLeft += stepFactor;