Articles tagged “lightwindow”

Remove a lightwindow trigger link after an AJAX call

Well, this is the result of 2 days of head-banging with lightwindow:

Index: public/javascripts/lightwindow.js, line 444
  _removeLink : function(removed) {
    // remove it from the links array
    //
    this.links = this.links.reject(function(link) {
      if (link == removed.href)
     return true;
    });
    // remove it from the gallery links array
    //
    if (gallery = this._getGalleryInfo(removed.rel)) {
      klass = gallery[0];
      name = gallery[1];
      if (this.galleries[klass] && this.galleries[klass][name]) {
        this.galleries[klass][name] = 
          this.galleries[klass][name].reject(function(link) {
            if (link == removed.href)
              return true;
          });
      }
    }
  },

call this function from your .rjs template, something like this:

page << "myLightWindow._removeLink($('element').down('a.lightwindow'));" 

More details to follow, when this work will be complete ;).

Posted at 17PM on 05/21/08 | 0 comments | Filed Under: development

About

This is sindro.me, a weblog by Marcello Barnaba (@vjt) about technology, ruby, development, software, the internet, entertainment, politics, sociology, and the answer to Life, Universe, and Everything (42).

Links