Jump to content
Search Community

IE Console Error if Using "self"

InTheOne test
Moderator Tag

Recommended Posts

Hello, this code works on all browser except IE and I was wondering if there is a work around for IE:

 

let mobile_menu = gsap.timeline({
      scrollTrigger: {
        trigger: "#site_content",
        toggleActions: "play none none none",
        start: "top top",
        end: "bottom bottom",
        onUpdate: (self) => {
            if(self.direction == -1){
              mobile_menu.reverse();
            } else if (self.direction == 1){
              mobile_menu.play();
            }
        }
      }
    });

The issue is with calling "self" in the onUpdate

 

Thank you!

Link to comment
Share on other sites

The issue is the arrow function. The same goes for using let. IE is forever stuck using an older version of JavaScript. Most people use babel to do the conversion, or they don't even worry about IE because it's a waste of time as Microsoft doesn't even support it.

 

var mobile_menu = gsap.timeline({
      scrollTrigger: {
        trigger: "#site_content",
        toggleActions: "play none none none",
        start: "top top",
        end: "bottom bottom",
        onUpdate: function(self) {
            if(self.direction == -1){
              mobile_menu.reverse();
            } else if (self.direction == 1){
              mobile_menu.play();
            }
        }
      }
    });

 

 

  • Like 4
  • Thanks 1
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.
×
×
  • Create New...