vertical positioning

Ask a Question related to Macromedia Dynamic HTML, Design and Development.

  1. #1

    Default vertical positioning

    Hi,

    Does anyone have a (relatively) reliable method of positioning a
    positionable element in the vertical centre (or other proportion) of a
    window, in a (relatively) cross browser compatible fashion, and without
    using any stiiiiiiiiinking tables? I'm thinking IE, Moz, Safari, any others
    a bonus. I know it's easy to do in IE and Netscrape... the central issue is
    just finding the window's height I guess.

    cheers
    Rob


    rob::digitalburn Guest

  2. Similar Questions and Discussions

    1. About positioning text
      Hi, i dont really know how to use the text in DreamWeaver. I know you can align it right,left etc.. But OMG cant you put it wherever you want??I...
    2. Vertical Positioning of Site
      Ok, I am stumped! I am a new developer, and I cannot seem to make my sites align vertically to the top of the window. I have tried this many times,...
    3. positioning
      im trying to move a div tag to the right side, ive tried using "float" but it doesnt work the way i want it to. i tried setting its position as...
    4. CSS Div Positioning
      Anybody know how to cause a DIV to be aligned to the bottom of the page? If you go to: http://www.tilaru.com/NewSite/index.php you'll see that my...
    5. positioning loadmovie
      hello, on level 0 : a button executing : loadmovie("1.JPEG",1) ( loaded to level 1 ) I would like to give a position (x,y) to this...
  3. #2

    Default Re: vertical positioning

    The attached code should help.

    The hard part is determining what the width and height of the element is.
    This needs to be set for the JS to read it.


    Ken

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
    <title>Untitled</title>
    <script language="JavaScript">
    <!--
    function valign(){
    var winW = 630, winH = 460;
    if (parseInt(navigator.appVersion)>3) {
    if (navigator.appName=="Netscape") {
    winW = window.innerWidth;
    winH = window.innerHeight;
    }
    if (navigator.appName.indexOf("Microsoft")!=-1) {
    winW = document.body.offsetWidth;
    winH = document.body.offsetHeight;
    }
    }
    w = (winW/2) - (parseInt(document.getElementById('myDiv').style.w idth)/2);
    h = (winH/2) - (parseInt(document.getElementById('myDiv').style.h eight)/2);
    document.getElementById('myDiv').style.left = w;
    document.getElementById('myDiv').style.top = h;
    }
    //-->
    </script>
    </head>

    <body onload="valign();">
    <div align="center" id="myDiv" style="border: thin solid Black; left: 200px;
    top: 50px; width: 300px; height: 50px; position: absolute;">
    This is the div..............
    </div>


    </body>
    </html>

    The ScareCrow Guest

  4. #3

    Default Re: vertical positioning

    Thanks. Knowing the height of the element being positioned is no problem,
    that's set already. Will this script work with things such as Moz and Safari
    though? Just looks as if it does IE and Netscrape to me...? Or am I missing
    something?


    The ScareCrow wrote:
    > The attached code should help.
    >
    > The hard part is determining what the width and height of the
    > element is. This needs to be set for the JS to read it.
    >
    >
    > Ken
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    >
    > <html>
    > <head>
    > <title>Untitled</title>
    > <script language="JavaScript">
    > <!--
    > function valign(){
    > var winW = 630, winH = 460;
    > if (parseInt(navigator.appVersion)>3) {
    > if (navigator.appName=="Netscape") {
    > winW = window.innerWidth;
    > winH = window.innerHeight;
    > }
    > if (navigator.appName.indexOf("Microsoft")!=-1) {
    > winW = document.body.offsetWidth;
    > winH = document.body.offsetHeight;
    > }
    > }
    > w = (winW/2) -
    > (parseInt(document.getElementById('myDiv').style.w idth)/2); h =
    > (winH/2) -
    > (parseInt(document.getElementById('myDiv').style.h eight)/2);
    > document.getElementById('myDiv').style.left = w;
    > document.getElementById('myDiv').style.top = h; } //-->
    > </script>
    > </head>
    >
    > <body onload="valign();">
    > <div align="center" id="myDiv" style="border: thin solid Black;
    > left: 200px; top: 50px; width: 300px; height: 50px; position:
    > absolute;"> This is the div..............
    > </div>
    >
    >
    > </body>
    > </html>

    rob::digitalburn Guest

  5. #4

    Default Re: vertical positioning

    I don't code for all these browsers, so I forget to allow for them. But I have
    found this code that should suffice for you

    if (self.innerHeight){
    // all except Explorer
    winW = window.innerWidth;
    winH = window.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight){
    // Explorer 6 Strict Mode
    winW = document.documentElement.clientWidth;
    winH = document.documentElement.clientHeight;
    }
    else if (document.body){
    // other Explorers
    winW = document.body.clientWidth;
    winH = document.body.clientHeight;
    }
    var test1 = document.body.scrollHeight;
    var test2 = document.body.offsetHeight;
    if (test1 > test2){
    // all but Explorer Mac
    winW = document.body.scrollWidth;
    winH = document.body.scrollHeight;
    }
    else{
    // Explorer Mac - would also work in Explorer 6 Strict, Mozilla and Safari
    winW = document.body.offsetWidth;
    winH = document.body.offsetHeight;
    }


    Ken

    The ScareCrow Guest

  6. #5

    Default Re: vertical positioning

    Okay, I'll check it out. More people are using Moz than Netscrape these days
    (and the percentage is increasing rapidly), so it's worth coding for. Plus
    if your code's compatible with Moz, it should be compatible with just about
    anything as it has decent standards support :)

    In fact, I heard that Moz downloads have gone from 10,000/week to
    200,000/week (or was that day, can't remember?) since the W3C stated that it
    thought that the security problems with IE were inherently unfixable.


    The ScareCrow wrote:
    > I don't code for all these browsers, so I forget to allow for them.
    > But I have found this code that should suffice for you
    >
    > if (self.innerHeight){
    > // all except Explorer
    > winW = window.innerWidth;
    > winH = window.innerHeight;
    > }
    > else if (document.documentElement &&
    > document.documentElement.clientHeight){ // Explorer 6 Strict Mode
    > winW = document.documentElement.clientWidth;
    > winH = document.documentElement.clientHeight;
    > }
    > else if (document.body){
    > // other Explorers
    > winW = document.body.clientWidth;
    > winH = document.body.clientHeight;
    > }
    > var test1 = document.body.scrollHeight;
    > var test2 = document.body.offsetHeight;
    > if (test1 > test2){
    > // all but Explorer Mac
    > winW = document.body.scrollWidth;
    > winH = document.body.scrollHeight;
    > }
    > else{
    > // Explorer Mac - would also work in Explorer 6 Strict, Mozilla and
    > Safari winW = document.body.offsetWidth;
    > winH = document.body.offsetHeight;
    > }
    >
    >
    > Ken

    rob::digitalburn Guest

  7. #6

    Default Re: vertical positioning

    rob::digitalburn wrote:
    > Okay, I'll check it out. More people are using Moz than Netscrape these days
    > (and the percentage is increasing rapidly), so it's worth coding for. Plus
    > if your code's compatible with Moz, it should be compatible with just about
    > anything as it has decent standards support :)
    >
    > In fact, I heard that Moz downloads have gone from 10,000/week to
    > 200,000/week (or was that day, can't remember?) since the W3C stated that it
    > thought that the security problems with IE were inherently unfixable.
    Well, there were 2 million copies downloaded in the space of ten days a
    while back. And people who are using it are really pushing it as the
    only valid alt to IE...at least, in Windows. I still prefer to use
    Safari on my Mac, but it handles stuff mostly the same as Mozilla.

    My biggest reason for using Safari over FF? FF doesn't have a little
    button you can click on to close a tab, and Safari does. It's the little
    things.
    Tron Guest

  8. #7

    Default Re: vertical positioning

    > (and the percentage is increasing rapidly)
    -----------------------------------^^^^^^^^^^^^^^^^^

    Poetic license? I'd say the percentage among the general surfing populace
    is increasing glacially.
    > In fact, I heard that Moz downloads have gone from 10,000/week to
    > 200,000/week (or was that day, can't remember?) since the W3C stated that
    > it
    > thought that the security problems with IE were inherently unfixable.
    You got a reference for this?

    --
    Murray --- ICQ 71997575
    Team Macromedia Volunteer for Dreamweaver
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    [url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
    [url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
    ==================

    "rob::digitalburn" <rob@digitalburn.net> wrote in message
    news:cl25ht$368$1@forums.macromedia.com...
    > Okay, I'll check it out. More people are using Moz than Netscrape these
    > days
    > (and the percentage is increasing rapidly), so it's worth coding for. Plus
    > if your code's compatible with Moz, it should be compatible with just
    > about
    > anything as it has decent standards support :)
    >
    > In fact, I heard that Moz downloads have gone from 10,000/week to
    > 200,000/week (or was that day, can't remember?) since the W3C stated that
    > it
    > thought that the security problems with IE were inherently unfixable.
    >
    >

    Murray *TMM* Guest

  9. #8

    Default Re: vertical positioning

    [url]http://news.com.com/Firefox+drawing+fans+away+from+Microsoft+IE/2100-1032_3-5368302.html?tag=st.rn[/url]

    This link has some facts and figures.

    "The percentage of visitors to e-commerce and corporate sites that used
    Firefox or another Mozilla browser grew to 5.2 percent in September, from
    3.5 percent in June 2004."

    That's a fairly big jump... I'm sure you can find more info. What's the
    matter anyway Murray, feeling a bit threatened be change are we? :)



    Murray *TMM* wrote:
    >> (and the percentage is increasing rapidly)
    >> -----------------------------------^^^^^^^^^^^^^^^^^
    >
    > Poetic license? I'd say the percentage among the general surfing
    > populace is increasing glacially.
    >
    >> In fact, I heard that Moz downloads have gone from 10,000/week to
    >> 200,000/week (or was that day, can't remember?) since the W3C stated
    >> that it
    >> thought that the security problems with IE were inherently unfixable.
    >
    > You got a reference for this?
    >
    >
    > "rob::digitalburn" <rob@digitalburn.net> wrote in message
    > news:cl25ht$368$1@forums.macromedia.com...
    >> Okay, I'll check it out. More people are using Moz than Netscrape
    >> these days
    >> (and the percentage is increasing rapidly), so it's worth coding
    >> for. Plus if your code's compatible with Moz, it should be
    >> compatible with just about
    >> anything as it has decent standards support :)
    >>
    >> In fact, I heard that Moz downloads have gone from 10,000/week to
    >> 200,000/week (or was that day, can't remember?) since the W3C stated
    >> that it
    >> thought that the security problems with IE were inherently unfixable.

    rob::digitalburn Guest

  10. #9

    Default Re: vertical positioning

    Exactly, attention to detail :)
    > My biggest reason for using Safari over FF? FF doesn't have a little
    > button you can click on to close a tab, and Safari does. It's the
    > little things.

    rob::digitalburn Guest

  11. #10

    Default Re: vertical positioning

    > feeling a bit threatened be change are we? :)

    Not at all. I actually use and prefer FF myself, but I just wanted to
    separate fact from fiction.

    --
    Murray --- ICQ 71997575
    Team Macromedia Volunteer for Dreamweaver
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    [url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
    [url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
    ==================

    "rob::digitalburn" <rob@digitalburn.net> wrote in message
    news:cl74vr$n94$1@forums.macromedia.com...
    > [url]http://news.com.com/Firefox+drawing+fans+away+from+Microsoft+IE/2100-1032_3-5368302.html?tag=st.rn[/url]
    >
    > This link has some facts and figures.
    >
    > "The percentage of visitors to e-commerce and corporate sites that used
    > Firefox or another Mozilla browser grew to 5.2 percent in September, from
    > 3.5 percent in June 2004."
    >
    > That's a fairly big jump... I'm sure you can find more info. What's the
    > matter anyway Murray, feeling a bit threatened be change are we? :)
    >
    >
    >
    > Murray *TMM* wrote:
    >>> (and the percentage is increasing rapidly)
    >>> -----------------------------------^^^^^^^^^^^^^^^^^
    >>
    >> Poetic license? I'd say the percentage among the general surfing
    >> populace is increasing glacially.
    >>
    >>> In fact, I heard that Moz downloads have gone from 10,000/week to
    >>> 200,000/week (or was that day, can't remember?) since the W3C stated
    >>> that it
    >>> thought that the security problems with IE were inherently unfixable.
    >>
    >> You got a reference for this?
    >>
    >>
    >> "rob::digitalburn" <rob@digitalburn.net> wrote in message
    >> news:cl25ht$368$1@forums.macromedia.com...
    >>> Okay, I'll check it out. More people are using Moz than Netscrape
    >>> these days
    >>> (and the percentage is increasing rapidly), so it's worth coding
    >>> for. Plus if your code's compatible with Moz, it should be
    >>> compatible with just about
    >>> anything as it has decent standards support :)
    >>>
    >>> In fact, I heard that Moz downloads have gone from 10,000/week to
    >>> 200,000/week (or was that day, can't remember?) since the W3C stated
    >>> that it
    >>> thought that the security problems with IE were inherently unfixable.
    >
    >

    Murray *TMM* Guest

  12. #11

    Default Re: vertical positioning

    Originally posted by: I don't know what version of firefox you are using, but
    with mine I have a little button to close the tabs and I got a cool extension
    which allows me to just double click the open tab to close it. I like that way
    better than the safari setup. &lt;br&gt; &lt;br&gt; Just my preference :-D
    Chill Newsgroup User rob::digitalburn wrote:&lt;BR&gt;&gt; Okay, I'll check it
    out. More people are using Moz than Netscrape these days&lt;BR&gt;&gt; (and the
    percentage is increasing rapidly), so it's worth coding for. Plus&lt;BR&gt;&gt;
    if your code's compatible with Moz, it should be compatible with just
    about&lt;BR&gt;&gt; anything as it has decent standards support
    :)&lt;BR&gt;&gt; &lt;BR&gt;&gt; In fact, I heard that Moz downloads have gone
    from 10,000/week to&lt;BR&gt;&gt; 200,000/week (or was that day, can't
    remember?) since the W3C stated that it&lt;BR&gt;&gt; thought that the security
    problems with IE were inherently unfixable.&lt;BR&gt;&lt;BR&gt;Well, there were
    2 million copies downloaded in the space of ten days a &lt;BR&gt;while back.
    And people who are using it are really pushing it as the &lt;BR&gt;only valid
    alt to IE...at least, in Windows. I still prefer to use &lt;BR&gt;Safari on my
    Mac, but it handles stuff mostly the same as Mozilla.&lt;BR&gt;&lt;BR&gt;My
    biggest reason for using Safari over FF? FF doesn't have a little
    &lt;BR&gt;button you can click on to close a tab, and Safari does. It's the
    little &lt;BR&gt;things.&lt;BR&gt;

    bsnyder2004 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139