Jump to content
GreenSock

sonner

Tweenmax with lightbox and next&prev navigation

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hello

I purchased a product with tweenmax and ligthbox fuction with Isoptope gallery. The problem is that when the lightbox gallery  is loaded there is not an option to navigate with the keyboard arrows or to close the lightbox with the escape key, its only possible to navigate with a next/prev and close button. 

 

Tweenmax is completely new for me and I have no clue where to begin ? could you help me ?

 

Is it possible to navigate in Tweenmax with keyboard ? or i it possible that the developer has disabled it ?

thanks for your time !

Link to comment
Share on other sites

Hi and welcome to the forums,

 

This seems like an issue with the gallery itself rather than TweenMax. If you provide the gallery name ( or link to the website ) I can give you more information.

 

One thing you could do is 

1) to find the elements ( arrows, close button ) that trigger the desired behavior

2) to listen for key events

3) once left arrow or right arrow or escape is pressed, you make the element that triggers desired behavior dispatch click event ( simulate mouse click)

 

It would look something like this:

 

 

var keyboardKeys = {left: 37, up: 38, right: 39, down: 40, escape: 27 };


var $arrowLeft = $(".arrowLeft");
var $arrowRight = $(".arrowRight");
var $closeLightbox = $(".closeLightbox");

$(document).keydown(function (e) {

var keyCode = e.keyCode || e.which;

 switch (keyCode) {
   case keyboardKeys.right:
     $arrowRight.click(); 
   break;
   case keyboardKeys.left:
    $arrowLeft.click();
   break;
    case keyboardKeys.escape:
    $closeLightbox.click();
   break;
 }
  
e.preventDefault();


});
  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×