Beispiel #1
0
 return delegate.bind(document, '[data-modal-id]', 'click', function(e){
   prevent(e);
   var el = e.delegateTarget || target(e);
   var _id = attr(el, 'data-modal-id');
   var newModal = new Modal(document.getElementById(_id));
   newModal.show();
 });
Beispiel #2
0
 return function(ev){
   var key = map[ev.which];
   if (key) {
     stop(ev);
     prevent(ev);
     on[state](ev, key);
     return false;
   }
 };
 return delegate.bind(document, '[data-dropdown-id]', 'click', function(e){
   prevent(e);
   var anchor = e.delegateTarget;
   if (classes(anchor).has('showing-dropdown')) return;
   var _id = attr(anchor).get('data-dropdown-id');
   var menu = document.getElementById(_id);
   if (menu) {
     var dd = new DropDown(anchor, menu);
     dd.show();
   }
 });
Beispiel #4
0
Modal.prototype.hide = function(e){
  if (e) prevent(e);
  if (!this.isShown) return this;
  this.unbind();
  this.emit('hiding');
  classes(this.el).remove('modal-show');
  this.previouslyFocused.focus();
  this.isShown = false;
  var self = this;
  afterTransition(this.el, function(){
    self.emit('hidden');
  });
  return this;
};
DropDown.prototype.testClose = function(e){
  var t = e.target;
  var sourceBtn = classes(t).has('showing-dropdown');
  if (sourceBtn){
    prevent(e);
    stop(e);
    if (t.tagName == 'INPUT') return;
  }
  var self = this;
  setTimeout(function(){
    if (self.autohide) self.hide();
  }, 0);  
  return this;
};
Zoom.prototype.hide = function(e){
  if (e) prevent(e);
  this.windowEvents.unbind();
  this.docEvents.unbind();
  this.setOriginalDeminsions();
  var self = this;
  self.emit('hiding');
  if (self._overlay) {
    self._overlay.hide();
  }
  afterTransition.once(self.clone, function(){
    self.thumb.style.opacity = 1;
    self.clone.parentNode.removeChild(self.clone);
    self.emit('hidden');
  });
  return this;
}
Zoom.prototype.show = function(e){
  if (e) prevent(e);
  this.getDimensions();
  var self = this;
  this.loadImage(function(){
    self.emit('showing');
    if (self._overlay) self._overlay.show();
    self.determineZoomedSize()
      .setOriginalDeminsions()
      .appendClone();
    self.thumb.style.opacity = 0;
    redraw(self.clone);
    self.setTargetPosition();
    afterTransition.once(self.clone, function(){
      self.emit('shown');
    });
  });
};