Jump to content

Use overflow Auto but hide the scroll bars


thewooleymammoth

Recommended Posts

nevermind overflow: hidden works, and ill post the js code incase some one looking wants to do the same thing

 

 

you need prototype and scriptaculous

Effect.Scroll = Class.create();
Object.extend(Object.extend(Effect.Scroll.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    var options = Object.extend({
      x:    0,
      y:    0,
      mode: 'absolute'
    } , arguments[1] || {}  );
    this.start(options);
  },
  setup: function() {
    if (this.options.continuous && !this.element._ext ) {
      this.element.cleanWhitespace();
      this.element._ext=true;
      this.element.appendChild(this.element.firstChild);
    }

    this.originalLeft=this.element.scrollLeft;
    this.originalTop=this.element.scrollTop;

    if(this.options.mode == 'absolute') {
      this.options.x -= this.originalLeft;
      this.options.y -= this.originalTop;
    } else {

    }
  },
  update: function(position) {   
    this.element.scrollLeft = this.options.x * position + this.originalLeft;
    this.element.scrollTop  = this.options.y * position + this.originalTop;
  }
});
          function moveTo(container, element){
          Position.prepare();
          container_y = Position.cumulativeOffset($(container))[1]
          element_y = Position.cumulativeOffset($(element))[1]
          new Effect.Scroll(container, {x:0, y:(element_y-container_y)});
          return false;
	 }

you can see a demo of it working here:

http://digitalart.ericwooley.com

its on the images to the left.

 

i originally got the code from here

 

http://elia.wordpress.com/2007/01/18/overflow-smooth-scroll-with-scriptaculous/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.