Hi.
Here is a suggestion:
https://bit.ly/3UOHrya
Code used (for reference only):
var links =
[
"https://www.pexels.com/pt-br/foto/sears-tower-eua-1722183/",
"https://www.pexels.com/pt-br/foto/edificio-de-vidro-na-fotografia-worm-s-eye-290275/",
"https://www.pexels.com/pt-br/foto/edificio-de-concreto-cinza-vermelho-e-laranja-439391/",
"https://www.pexels.com/pt-br/foto/edificios-altos-cinzentos-936722/",
"https://www.pexels.com/pt-br/foto/fotografia-vista-da-cidade-perto-da-agua-290595/",
"https://www.pexels.com/pt-br/foto/empire-state-building-nova-york-466685/"
];
var prevButton, nextButton, thumbs;
function main()
{
setup();
setNavigation();
setLinks();
}
function setup()
{
createjs.Touch.enable(stage);
createjs.MovieClip.prototype.playUntil = function(positionOrLabel, ease)
{
var duration;
var to = this.timeline.resolve(positionOrLabel);
this.tweenFrame = this.timeline.position;
if (this.tweenFrame == null)
return;
duration = Math.abs(((to - this.tweenFrame) / lib.properties.fps) * 1000);
createjs.Tween.get(this, { override: true }).to({ tweenFrame: to }, duration, ease).addEventListener("change", function(e)
{
var target = e.currentTarget.target;
target.gotoAndStop(Math.round(target.tweenFrame));
if (target.tweenFrame === to)
e.remove();
});
};
prevButton = root.prevButton;
nextButton = root.nextButton;
thumbs = root.thumbs;
root.stop();
}
function setNavigation()
{
thumbs.index = 0;
thumbs.stop();
prevButton.on("click", onPrev);
nextButton.on("click", onNext);
}
function onPrev()
{
thumbs.index = Math.max(thumbs.index - 1, 0);
thumbs.playUntil("thumb" + thumbs.index, createjs.Ease.sineInOut);
}
function onNext()
{
thumbs.index = Math.min(thumbs.index + 1, thumbs.labels.length - 1);
thumbs.playUntil("thumb" + thumbs.index, createjs.Ease.sineInOut);
}
function setLinks()
{
thumbs.children.forEach(function(child, index)
{
child.mouseChildren = false;
child.cursor = "pointer";
child.on("click", function()
{
window.open(links[index], "_blank");
});
});
}
if (!this.started)
{
window.root = this;
main();
this.started = true;
}
I hope it helps.
Regards,
JC