Re: hide whole body but one div

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Henry

    Re: hide whole body but one div

    On Jul 2, 5:57 pm, Jorge wrote:
    <snip>
    document.body.s tyle.visibility = "none";
    <snip>

    The specified values for the CSS 'visibility' property do not include
    'none'. Such a declaration should be ignored, and if not ignored can
    be expected to be subject to inconsistent handling.
  • Jorge

    #2
    Re: hide whole body but one div

    On Jul 2, 7:09 pm, Henry <rcornf...@rain drop.co.ukwrote :
    On Jul 2, 5:57 pm, Jorge wrote:
    <snip>document. body.style.visi bility= "none";
    >
    <snip>
    >
    The specified values for the CSS 'visibility' property do not include
    'none'. Such a declaration should be ignored, and if not ignored can
    be expected to be subject to inconsistent handling.
    Hmmm, yes :

    document.body.s tyle.visibility = "hidden";
    (document.getEl ementById('cent erPage')).style .visibility= "visible";

    --Jorge

    Comment

    • SAM

      #3
      Re: hide whole body but one div

      Jorge a écrit :
      >
      document.body.s tyle.visibility = "hidden";
      (document.getEl ementById('cent erPage')).style .visibility= "visible";
      With an other way that could interest the OP :
      - remove all divs and show the right one
      Variante 1 : <http://cjoint.com/?hcvUjZSFGt>
      Variante 2 : <http://cjoint.com/?hcvWd8I0zj>

      I leave to you the opportunity to get time(s) of execution ;-)

      --
      sm

      Comment

      • czechboy

        #4
        Re: hide whole body but one div

        Thanks for your answers... I will study links you provided me.

        What I want to do is to load some page (like google.com) hide it and
        then display only one div.

        Problem with visibility is that hidden elements still keep their
        places... for that display="none" looks much better, but unfortunately
        does not work with nested elements to be visible

        Comment

        • Jorge

          #5
          Re: hide whole body but one div

          On Jul 2, 9:51 pm, SAM <stephanemoriau x.NoAd...@wanad oo.fr.invalid>
          wrote:
          Jorge a écrit :
          >
          document.body.s tyle.visibility = "hidden";
          (document.getEl ementById('cent erPage')).style .visibility= "visible";
          >
          With an other way that could interest the OP :
            - remove all divs and show the right one
          Variante 1 : <http://cjoint.com/?hcvUjZSFGt>
          Variante 2 : <http://cjoint.com/?hcvWd8I0zj>
          Good idea. I have mixed all 3 in a single file : http://tinyurl.com/64h5x2

          1.- Hide by setting style.visibilit y= "hidden"
          2.- Hide by extracting the element out of document.body.
          3.- Hide by setting style.display= "none".

          But the OP question still remains unanswered : if
          document.body.s tyle.display === "none", is there a way to override
          this setting on an inner element ?

          I don't know the answer.

          I know that document.body.s tyle.visibility = "hidden" can be easily
          overriden on an inner element just by setting the element's
          style.visibilit y= "visible". How can this be done if
          document.body.s tyle.display === "none" ?
          I leave to you the opportunity to get time(s) of execution ;-)
          8-)

          --Jorge

          Comment

          • RobG

            #6
            Re: hide whole body but one div

            On Jul 3, 9:37 am, Jorge <jo...@jorgecha morro.comwrote:
            On Jul 2, 9:51 pm, SAM <stephanemoriau x.NoAd...@wanad oo.fr.invalid>
            wrote:
            >
            Jorge a écrit :
            >
            document.body.s tyle.visibility = "hidden";
            (document.getEl ementById('cent erPage')).style .visibility= "visible";
            >
            With an other way that could interest the OP :
              - remove all divs and show the right one
            Variante 1 : <http://cjoint.com/?hcvUjZSFGt>
            Variante 2 : <http://cjoint.com/?hcvWd8I0zj>
            >
            Good idea. I have mixed all 3 in a single file :http://tinyurl.com/64h5x2
            >
            1.- Hide by setting style.visibilit y= "hidden"
            2.- Hide by extracting the element out of document.body.
            3.- Hide by setting style.display= "none".
            >
            But the OP question still remains unanswered : if
            document.body.s tyle.display === "none", is there a way to override
            this setting on an inner element ?
            That is a CSS question, the answer is in the CSS 2.1 Specification:

            'display'
            [...]
            none
            This value causes an element to generate no boxes in
            the formatting structure (i.e., the element has no effect on
            layout). Descendant elements do not generate any boxes either;
            this behavior cannot be overridden by setting the 'display'
            property on the descendants.

            <URL: http://www.w3.org/TR/CSS21/visuren.html#propdef-display >

            I don't know the answer.
            You should now :-)
            I know that document.body.s tyle.visibility = "hidden" can be easily
            overriden on an inner element just by setting the element's
            style.visibilit y= "visible".
            Because that is how visibility is specified to work:

            <URL: http://www.w3.org/TR/CSS21/visufx.ht...def-visibility >
            How can this be done if
            document.body.s tyle.display === "none" ?
            It can't in a UA that conforms with CSS 2.1.


            --
            Rob

            Comment

            • Jorge

              #7
              Re: hide whole body but one div

              On Jul 3, 4:31 am, RobG <rg...@iinet.ne t.auwrote:
               'display'
               [...]
              >
                  this behavior cannot be overridden by setting the 'display'
                  property on the descendants.
              >
              <URL:http://www.w3.org/TR/CSS21/visuren.html#pr opdef-display>
              >
              I don't know the answer.
              >
              You should now :-)
              Clear as an azure sky of deepest summer.

              /8¬)

              Thanks,
              --Jorge.

              Comment

              • SAM

                #8
                Re: hide whole body but one div

                Jorge a écrit :
                >
                But the OP question still remains unanswered : if
                document.body.s tyle.display === "none", is there a way to override
                this setting on an inner element ?
                >
                I don't know the answer.
                I think : no.
                I'm surprised that visibilty works.
                But all that is a question of logic.
                >I leave to you the opportunity to get time(s) of execution ;-)
                >
                8-)
                ¡Tanto peor! jamás lo sabría.

                javascript:docu ment.body.inner HTML=document.g etElementById(' aDiv').innerHTM L;

                told us Evertjean

                and button back to reverse I presume

                Plus simple tu meurs ;-)

                --
                sm

                Comment

                Working...