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

Dom.setStyle( el, 'z-index', ??????? )...

Expand Messages
  • mark.deibert
    Do you see anything wrong with this snippet?... var el = document.createElement( DIV ) el.id = PnlViewer ; this.div.appendChild(el);
    Message 1 of 5 , May 29, 2006
    • 0 Attachment
      Do you see anything wrong with this snippet?...

      var el = document.createElement('DIV')
      el.id = 'PnlViewer';
      this.div.appendChild(el);
      Dom.setStyle(el,'position','absolute');
      Dom.setStyle(el,'z-index',200);
      Dom.setStyle(el,'border','Solid 1px Yellow');
      Dom.setStyle(el,'width','10px');
      Dom.setStyle(el,'height','10px');


      I'm trying to make the 'PnlViewer' Div to appear -in front- of
      everything else. I've tried setting the z-index very high and very low
      and nothing changes. The Div never moves to the front. z-index doesn't
      appear to do anything at all.

      What am I doing wrong?

      Thanks guys :-)
    • Matt Sweeney
      Hi Mark, The Dom style interface accepts only camelCase for style properties. Changing the call to Dom.setStyle(el, zIndex , 200) should fix it. Matt
      Message 2 of 5 , May 30, 2006
      • 0 Attachment
        Hi Mark,

        The Dom style interface accepts only camelCase for style properties.
        Changing the call to "Dom.setStyle(el, 'zIndex', 200) should fix it.

        Matt

        mark.deibert wrote:

        >Do you see anything wrong with this snippet?...
        >
        > var el = document.createElement('DIV')
        > el.id = 'PnlViewer';
        > this.div.appendChild(el);
        > Dom.setStyle(el,'position','absolute');
        > Dom.setStyle(el,'z-index',200);
        > Dom.setStyle(el,'border','Solid 1px Yellow');
        > Dom.setStyle(el,'width','10px');
        > Dom.setStyle(el,'height','10px');
        >
        >
        >I'm trying to make the 'PnlViewer' Div to appear -in front- of
        >everything else. I've tried setting the z-index very high and very low
        >and nothing changes. The Div never moves to the front. z-index doesn't
        >appear to do anything at all.
        >
        >What am I doing wrong?
        >
        >Thanks guys :-)
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
      • Matt Warden
        ... I assumed that this was because of how JS internally handles the style property (by creating an object whose properties are camel-case versions of the
        Message 3 of 5 , May 30, 2006
        • 0 Attachment
          On 5/30/06, Matt Sweeney <msweeney@...> wrote:
          > Hi Mark,
          >
          > The Dom style interface accepts only camelCase for style properties.
          > Changing the call to "Dom.setStyle(el, 'zIndex', 200) should fix it.

          I assumed that this was because of how JS internally handles the style
          property (by creating an object whose properties are camel-case
          versions of the style properties), and that turned out to be correct.
          I think it would be good to abstract this detail. If you change lines
          122-123 in dom.js from this:

          default :
          el.style[property] = val;

          to this:


          default :
          // remove hyphens and capitalize each post-hyphen letter
          var pieces = property.split('-');
          property = pieces[0];
          for (var i=1; i<pieces.length; i++) {
          property += (pieces[i].charAt(0).toUpperCase()
          + pieces[i].slice(1));
          }
          el.style[property] = val;

          then setStyle can now accept normal style properties. The same can be
          added to getStyle().

          --
          Matt Warden
          Oxford, OH, USA
          http://mattwarden.com


          This email proudly and graciously contributes to entropy.
        • Philip Tellis
          ... I prefer this: property = property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}); -- Free yourself from negative influence. Negative
          Message 4 of 5 , May 30, 2006
          • 0 Attachment
            Sometime on May 30, MW cobbled together some glyphs to say:

            > default :
            > // remove hyphens and capitalize each post-hyphen letter
            > var pieces = property.split('-');
            > property = pieces[0];
            > for (var i=1; i<pieces.length; i++) {
            > property += (pieces[i].charAt(0).toUpperCase()
            > + pieces[i].slice(1));
            > }
            > el.style[property] = val;


            I prefer this:

            property = property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()});


            --
            Free yourself from negative influence. Negative thoughts are the old
            habits that gnaw at the roots of the soul.
            Moses Shongo, (Seneca)
          • mark.deibert
            Doh! That s all it is? I ll try when I get home. Thanks guys! :-) ... properties. ... it. ... very low ... doesn t
            Message 5 of 5 , May 31, 2006
            • 0 Attachment
              Doh! That's all it is? I'll try when I get home. Thanks guys! :-)

              --- In ydn-javascript@yahoogroups.com, Matt Sweeney <msweeney@...>
              wrote:
              >
              > Hi Mark,
              >
              > The Dom style interface accepts only camelCase for style
              properties.
              > Changing the call to "Dom.setStyle(el, 'zIndex', 200) should fix
              it.
              >
              > Matt
              >
              > mark.deibert wrote:
              >
              > >Do you see anything wrong with this snippet?...
              > >
              > > var el = document.createElement('DIV')
              > > el.id = 'PnlViewer';
              > > this.div.appendChild(el);
              > > Dom.setStyle(el,'position','absolute');
              > > Dom.setStyle(el,'z-index',200);
              > > Dom.setStyle(el,'border','Solid 1px Yellow');
              > > Dom.setStyle(el,'width','10px');
              > > Dom.setStyle(el,'height','10px');
              > >
              > >
              > >I'm trying to make the 'PnlViewer' Div to appear -in front- of
              > >everything else. I've tried setting the z-index very high and
              very low
              > >and nothing changes. The Div never moves to the front. z-index
              doesn't
              > >appear to do anything at all.
              > >
              > >What am I doing wrong?
              > >
              > >Thanks guys :-)
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              > >Yahoo! Groups Links
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.