Sha256: ae149d27c1fb9a92bf44eeb7b1da837454124dbaa4007979377c3ebd11f25881

Contents?: true

Size: 1.5 KB

Versions: 23

Compression:

Stored size: 1.5 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 btn  = `.btn.nav.${val.name}`,
      exit = `.exit.${val.name}`;

  $(btn).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

23 entries across 23 versions & 1 rubygems

Version Path
futuro-0.7.0 assets/js/footer/custom/Overlays.js
futuro-0.6.9 assets/js/footer/custom/Overlays.js
futuro-0.6.8 assets/js/footer/custom/Overlays.js
futuro-0.6.7 assets/js/footer/custom/Overlays.js
futuro-0.6.6 assets/js/footer/custom/Overlays.js
futuro-0.6.5 assets/js/footer/custom/Overlays.js
futuro-0.6.4 assets/js/footer/custom/Overlays.js
futuro-0.6.3 assets/js/footer/custom/Overlays.js
futuro-0.6.2 assets/js/footer/custom/Overlays.js
futuro-0.6.1 assets/js/footer/custom/Overlays.js
futuro-0.6.0 assets/js/footer/custom/Overlays.js
futuro-0.5.9 assets/js/footer/custom/Overlays.js
futuro-0.5.8 assets/js/footer/custom/Overlays.js
futuro-0.5.7 assets/js/footer/custom/Overlays.js
futuro-0.5.6 assets/js/footer/custom/Overlays.js
futuro-0.5.5 assets/js/footer/custom/Overlays.js
futuro-0.5.4 assets/js/footer/custom/Overlays.js
futuro-0.5.3 assets/js/footer/custom/Overlays.js
futuro-0.5.2 assets/js/footer/custom/Overlays.js
futuro-0.5.1 assets/js/footer/custom/Overlays.js