Previously, by mistake I added request in wish list for slide like MSN.
Actully it was Blind like msn. However it was my mistake so I tried to
created script by my slef - and able to do it.

But I am new to this, so my script is not in good condition.

Effect.Scale2 = Class.create();
Object.extend(Object.extend(Effect.Scale2.prototype, Effect.Base.prototype), {
  initialize: function(element, percent) {
    this.element = $(element)
    var options = Object.extend({
      scaleMode: 'box',        // 'box' or 'contents' or {} with provided values
      scaleFrom: 100.0,
      scaleTo:   percent
    }, arguments[2] || {});
    this.start(options);
  },
  setup: function() {
    this.restoreAfterFinish = this.options.restoreAfterFinish || false;
    this.elementPositioning = this.element.getStyle('position');

    this.originalStyle = {};
    ['top','left','width','height','fontSize'].each( function(k) {
      this.originalStyle[k] = this.element.style[k];
    }.bind(this));

    this.originalTop  = this.element.offsetTop;
    this.originalLeft = this.element.offsetLeft;
    this.originalHeight  = this.element.offsetHeight;
    this.originalWidth = this.element.offsetWidth;

    this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;

    this.dims = null;
    if(this.options.scaleMode=='box')
      this.dims = [this.element.offsetHeight, this.element.offsetWidth];
    if(/^content/.test(this.options.scaleMode))
      this.dims = [this.element.scrollHeight, this.element.scrollWidth];
    if(!this.dims)
      this.dims = [this.options.scaleMode.originalHeight,
                   this.options.scaleMode.originalWidth];
  },
  update: function(position) {
    var currentScale = (this.options.scaleFrom / 100.0) + (this.factor
* position);
    this.setDimensions(this.dims[0] * currentScale, this.dims[1] *
currentScale);
  },
  finish: function(position) {
    if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
  },
  setDimensions: function(height, width) {
    var d = {};
    d.height = height + 'px';
    d.top = (this.originalTop + (this.originalHeight - height) ) + 'px';
    this.element.setStyle(d);
  }
});

Effect.BlindBottomUp = function(element) {
  element = $(element);
  element.makeClipping();
  element.setStyle({position: 'absolute'});
  return new Effect.Scale2(element, 100,
    Object.extend({ scaleContent: false,
      scaleX: false,
      scaleFrom: 0,
      restoreAfterFinish: true,
      afterFinishInternal: function(effect) {
        effect.element.undoClipping();
      }
    }, arguments[1] || {})
  );
}



If possible someone please update script and make it more
understandable for others.

--
Thanks,
Ashish Agrawal
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to