Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] Re: YAHOO.util.Scroll using "by" instead of "to"?

Expand Messages
  • Matt Sweeney
    Hi Vineet, If you dont want to animate one of the axes, use the current scroll offset for that axis: var el = document.getElementById( some-id ); var
    Message 1 of 4 , Apr 17, 2006
    • 0 Attachment
      Hi Vineet,

      If you dont want to animate one of the axes, use the current scroll offset for that axis:

         var el = document.getElementById('some-id');
         var scroll_attribute = {
            to: [
               el.scrollLeft,  // maintain current scrollLeft
         var anim = new YAHOO.util.Scroll(el, { 'scroll': scroll_attribute }, 2);


      vineetb wrote:
      Is it possible to keep y-axis the same (if the user has scrolled manually) and just move the 
      x-axis? And vice-versa?
      Perhaps some way to get the scroll attributes and use that instead of 0?
      Thanks for the awesome library. We are using this in our enterprise-wide portal 
      - vineet
      --- In ydn-javascript@yahoogroups.com, Matt Sweeney <msweeney@...> wrote:
      Hi sirshannon,
      Thanks for pointing this out.  There is an issue with relative scrolling 
      that will be addressed in the next build.
      For now you can simulate by doing something like:
      // horizontal ScrollBy
         var anim = new YAHOO.util.Scroll('scroll', { scroll: { by: [100, 0] } 
      }, 1, YAHOO.util.Easing.easeOut);
         var scrollBy = function() {
            var el = anim.getEl();
            anim.attributes.scroll = {
               from: [el.scrollLeft, 0],
               to: [el.scrollLeft + anim.attributes.scroll.by[0], 0],
               by: anim.attributes.scroll.by
      sirshannon wrote:
      Reading the API docs, I thought that you can scroll "by" a value as
      well as "to" a value:
      'Each attribute is an object with at minimum a "to" or "by" member
      I have not been able to find a way to scroll by a pixel amount using
      attributes like   { scroll: { by: [0,-20] } }  (NOT REAL CODE, I've
      tried many ways and none worked so I can't really post any relevant
      non-working code, every way I tried failed).
      Is this possible?
      (scrolling "to" works fine as shown in the examples and docs)
      Yahoo! Groups Links
      Yahoo! Groups Links
      <*> To visit your group on the web, go to:
      <*> To unsubscribe from this group, send an email to:
      <*> Your use of Yahoo! Groups is subject to:

    Your message has been successfully submitted and would be delivered to recipients shortly.