Sha256: 40175705b00c318bf857ffdb2c64830cc9ab407f7cdac121e4d453a36681ba00

Contents?: true

Size: 1.53 KB

Versions: 4

Compression:

Stored size: 1.53 KB

Contents

const ChangeScreen = (i,val,state) => {

  if (state == "close") {
    gsap.set(body,{ clearProps : "overflow" });
    gsap.set(".overlay." + Overlay.custom[i].name, { clearProps : "display" });
    Overlay.custom[i].open = false;
  } else {
    gsap.set(body, { overflow : "hidden" });
    gsap.set(".overlay." + Overlay.custom[i].name, { display : Config.display });
    Overlay.custom[i].open = true;
  }
}

const BuildScreens = (i,val) => {
  let button = Overlay.button + "." + val.name,
      exit   = Overlay.exit + "." + val.name;

  $(button).click(function() {
    ChangeScreen(i,val,"open");
  });

  $(exit).click(function() {
    ChangeScreen(i,val,"close");
  });
}

const KeyUp = e => {

  if (e.keyCode == 27) {
    $(Overlay.custom).each(function(i,val) {
      if (Overlay.custom[i].open) {
        ChangeScreen(i,val,"close");
      }
    });
  }

  if (e.keyCode == 65) {
    $(Overlay.custom).each(function(i,val) {
      if (!Overlay.custom[0].open) {
        ChangeScreen(0,val,"open");
        console.log(e.keyCode);
      }
    });
  }

  if (e.keyCode == 66) {
    $(Overlay.custom).each(function(i,val) {
      if (!Overlay.custom[1].open) {
        ChangeScreen(1,val,"open");
      }
    });
  }

  if (e.keyCode == 83) {
    $(Overlay.custom).each(function(i,val) {
      if (!Overlay.custom[2].open) {
        ChangeScreen(2,val,"open");
      }
    });
  }
}

$(function(){
  $(Overlay.custom).each(function(i,val) {
    BuildScreens(i,val);
  });
});

$(document).keyup(function(e) {
  if (!Site.focus) {
    KeyUp(e);
  }
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
futuro-0.7.4 assets/js/footer/custom/Overlays.js
futuro-0.7.3 assets/js/footer/custom/Overlays.js
futuro-0.7.2 assets/js/footer/custom/Overlays.js
futuro-0.7.1 assets/js/footer/custom/Overlays.js