You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

40 lines
764 B

  1. define([
  2. 'js/system/events',
  3. 'html!ui/templates/overlay/template',
  4. 'css!ui/templates/overlay/styles'
  5. ], function (
  6. events,
  7. template,
  8. styles
  9. ) {
  10. return {
  11. tpl: template,
  12. focusEl: null,
  13. lastZIndex: 0,
  14. postRender: function () {
  15. events.on('onShowOverlay', this.onShowOverlay.bind(this));
  16. events.on('onHideOverlay', this.onHideOverlay.bind(this));
  17. },
  18. onShowOverlay: function (focusEl) {
  19. this.focusEl = focusEl;
  20. this.lastZIndex = focusEl.css('z-index');
  21. focusEl.css('z-index', ~~this.el.css('z-index') + 1);
  22. this.show();
  23. },
  24. onHideOverlay: function (focusEl) {
  25. if (!this.focusEl)
  26. return;
  27. if (focusEl[0] != this.focusEl[0])
  28. return;
  29. this.focusEl.css('z-index', this.lastZIndex);
  30. this.hide();
  31. }
  32. };
  33. });