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

YAHOO.util.Point question

Expand Messages
  • Charles
    Hello, I m feeling stupid. Why doesn t this work? var pos = new YAHOO.util.Point(100, 100); YAHOO.util.Dom.setXY( searchResults , pos); I am able to set the XY
    Message 1 of 7 , Apr 2, 2006
    • 0 Attachment

      Hello,

       

      I’m feeling stupid. Why doesn’t this work?

       

            var pos = new YAHOO.util.Point(100, 100);

            YAHOO.util.Dom.setXY('searchResults', pos);

       

      I am able to set the XY of ‘searchResults’ if I first get the XY of another element.

       

      — Charles

       

    • Matt Sweeney
      Hi Charles, YAHOO.util.Point is a subclass of YAHOO.util.Region, which is an object with the properties top, right, bottom, left . In the case of a Point,
      Message 2 of 7 , Apr 2, 2006
      • 0 Attachment
        Hi Charles,

        YAHOO.util.Point is a subclass of YAHOO.util.Region, which is an object with the properties "top, right, bottom, left".  In the case of a Point, left == right, and top == bottom.

        YAHOO.util.Dom.setXY accepts an array comprised of X and Y coordinates.

        You could either do:
        YAHOO.util.Dom.setXY('searchResults', [100, 100]);
        or
        var pos = new YAHOO.util.Point(100, 100);
        YAHOO.util.Dom.setXY('searchResults', [pos.left, pos.top]);

        This brings up a good point, though.  Perhaps setXY should also accept an object with "top, left" properties.

        Matt

        Charles wrote:

        Hello,

         

        I’m feeling stupid. Why doesn’t this work?

         

              var pos = new YAHOO.util.Point(100, 100);

              YAHOO.util.Dom.setXY('searchResults', pos);

         

        I am able to set the XY of ‘searchResults’ if I first get the XY of another element.

         

        — Charles

         



      • Charles
        Thanks, Matt! This brings up a good point, though. Perhaps setXY should also accept an object with top, left properties. Yeah, it seemed reasonable to
        Message 3 of 7 , Apr 3, 2006
        • 0 Attachment

          Thanks, Matt!

           

          This brings up a good point, though.  Perhaps setXY should also accept an object with "top, left" properties.

           

          Yeah, it seemed reasonable to expect setXY to accept a Point directly.

           

          (I’ll probably have several similarly-silly questions over the next couple of months, but hope to be able to contribute answers soon…)

           

          — Charles

           


          From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of Matt Sweeney
          Sent: Sunday, April 02, 2006 4:32 PM
          To: ydn-javascript@yahoogroups.com
          Subject: Re: [ydn-javascript] YAHOO.util.Point question

           

          Hi Charles,

          YAHOO.util.Point is a subclass of YAHOO.util.Region, which is an object with the properties "top, right, bottom, left".  In the case of a Point, left == right, and top == bottom.

          YAHOO.util.Dom.setXY accepts an array comprised of X and Y coordinates.

          You could either do:
          YAHOO.util.Dom.setXY('searchResults', [100, 100]);
          or
          var pos = new YAHOO.util.Point(100, 100);
          YAHOO.util.Dom.setXY('searchResults', [pos.left, pos.top]);

          This brings up a good point, though.  Perhaps setXY should also accept an object with "top, left" properties.

          Matt

          Charles wrote:

          Hello,

           

          I’m feeling stupid. Why doesn’t this work?

           

                var pos = new YAHOO.util.Point(100, 100);

                YAHOO.util.Dom.setXY('searchResults', pos);

           

          I am able to set the XY of ‘searchResults’ if I first get the XY of another element.

           

          — Charles

           

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