Web Analytics Made Easy -
StatCounter weird! ns6 puts my divs in negative space, but ie6 and mozilla 1 render fine ?!? - CodingForum


No announcement yet.

weird! ns6 puts my divs in negative space, but ie6 and mozilla 1 render fine ?!?

  • Filter
  • Time
  • Show
Clear All
new posts

  • weird! ns6 puts my divs in negative space, but ie6 and mozilla 1 render fine ?!?

    well, i'm writing a convenience lib of obj methods for manipulating divs and other animation tricks for myself and possibly others later...

    ... i'm using these libs to build a site for my bro-in-law... cuz the first attempt to revamp the site ended up screwed up by a reload thing i didn't know about in NS6...

    ... so, here i am with NS6 biting its thumb at me yet again! I wish it wasn't so hard to find out little quirks like these ...

    anyway, i'm making an object of a div that contains all content within the main body, absolutely positioned in css, and is supposed to dynamically recenter in the browser window onresize... other divs reference their xy from the stored xy of the main body div, so fixing the main one ought to fix them all...

    the problem is that in IE5/6 and the new Mozilla 1.0 release, all is fine! But in NS6.2 (which i thought would act like Moz, considering the *same* engine, or so they keep claiming) the div somehow is getting pushed into negative space (horizontally) and i can't fathom what for!?!

    i have validated clean as HTML 4.01 Strict (though i'm DTD'ing it Trans for now) and CSS2 (well, apart from a font-family warning).. and i still have not a clue. This really disturbs me, because I am very used to things showing up as I expect them to... but this one seems to defy me out of spite

    i guess i'm hoping better eyes will prevail @@..

    i attatched the code files in a zip minus pix (too big)... thanks in advance for any help.
    Attached Files
    *Bites* -- I warned em ...

  • #2
    ciao rabid

    it's is not clear what you can't fix. I cannot understand what you mean by:
    "making an object of a div that contains all content within the main body"

    A div is a "layer" and it's ok, but what do you mean by making an object of it - and if the div has to contain all the contents in between the body tags have I understood it correctly? For if so, why you rewrite all the contents of a page inside a div and the recenter it? I mean that if you can elaborate more on what you were attempting to achive, probalby you can get some solutions.

    If you can post inline the relevant snippets of code is better: that helps member to focus on the relevant snippets: if nothing is found in them, we can step up the ladder to find the snippet which may cause the problem.

    Alberto http://www.unitedscripters.com/


    • #3
      NS6 *is* based on the same codebase, but relatively a much older version. This could be a bug manifesting itself that has since been fixed in Mozilla 1.0 or earlier builds.


      • #4

        ok, sorry for not being so clear...

        i am trying to contain all of the main content of the page in an absolutely positioned div. this serves two purposes.. 1. i can make the main content area center in the browser window (which i need to do for this design) all at once, instead of centering each individual element... 2. i can use the css 'top' and 'left' values of the main div to make other 'independently floating around' divs maintain relative positioning to the main div without being a child of the main div.

        i give the main div an ID and i use the ID as an argument to an object that i create for purposes of dynamically altering the main div's attributes in an object-oriented fashion... using object methods to change the css values of its associated html element and track other pertinent information more easily... for instance i can make an object-controlled div made in this fashion orbit a fixed origin using one method, as opposed to coding this functionality for each div i want to have do this... code once, serve many...

        -- what is happening is that i am loading the page... after it loads, an initialization script creates objects from three divs... these objects get window size, browser info, and predefined constants and sets the css style of the three divs, one at a time.

        -- next, the (windows size minus the size of the main div) divided by two = the xy coords that will center the div in the window. this works correctly in both IE5/5.5/6 and Mozilla 1.0, but barfs in NS6... where the main div is mysteriously shoves off the left side of the window, half into negative coordinate space, though the vertical placement is correct.

        -- after the main div is positioned, the xy coords of the main div are used as reference points for positioning the second div, which is a 3D-looking navigation arrow-type thingy, which kinda lays down somewhat so that it acts like a 'platform' for a character, which is the third div... called the narrator.

        -- so, second div: platform ; third div: narrator ;

        -- the initialization script positions the platform relative to the main div, and the platform is set into motion using a set of methods that make it hover up and down in a finite area, and each iteration the position of the narrator is updated to keep 'her' on the platform

        -- i had coded this far, testing in Mozilla and IE... big mistake thinking NS6 an Mozilla would react the same.. obviously there are crucial diffs which i still have not found to be disclosed anywhere at devedge or mozilla.org

        -- since the second and third divs are positioned over the left portion of the main div, they too are shoved offscreen so i can't tell if they are working correctly

        -- anyway... it is rather complex, which is why i included the libs and css in the zip, so that maybe an obvious error or something else i should have caught might be noticed by fresh eyes @@

        -- basically, the lib files do these things

        >> (root/resources/obj/webscript.beta/):

        - init.webscript.inc.js = an 'inc'lude file, setting up config data and other stuff needed for the core lib file, listed next:

        - init.webscript.lib.js = the core library, provides browser detection, an object constructor, and various methods of manipulating the css style attributes of the element the object interacts with. all extravagent methods are grouped into their own libs to keep unused code to a minimum.

        - layers.webscript.inc.js = sets up layers lib file configs like the other 'inc' file.

        - layers.webscript.lib.js = offers more advanced manipulation of layer-type objects, such as ones made to interact with div elements. includes methods that make a div do circles, oscillate like a fan back and forth, slide into place, shrink and expand, constrain the div positioning to a given area like the window size and detect mouse events, so you can drag-n-drop the divs

        >> (root/resources/obj/home/initialize):

        - home.webscript.inc.js = this is the initialization script that makes use of the above libs to position the divs and make them do stuff on page load, and re-center them on window resize, among other things i haven't gotten to due to this problem i'm having @8?-

        sorry this is so long, but as i said, its a bit complex. thanx.
        *Bites* -- I warned em ...


        • #5
          bug, eh?

          so, how far off is NS7 from release date?
          maybe i'll DL the beta and see if it fixes the problem... still, if anyone else sees a flaw in the code that is causing this, let me know...

          BTW, anyone know of an online JavaScript Validator, ala W3C HTML and CSS Validation? This would be a great help to me

          *Bites* -- I warned em ...


          • #6
            The NS7 PR is based on Mozilla 1.0 RC3 I believe. Which is nearly identical to the Mozilla 1.0 release...


            • #7
              AHK! I FIGURED IT OUT! now i feel dumb

              man, do i feel dumb

              but i figured it out...

              i just couldn't gt why it was that a centering process, which should have at least resulted in a positive x-coordinate value would have resulted in a negative one...

              here's what happened:

              to center the div in the browser window, i captured the window width in variable A, i captured the width of my div in variable B, and then used this formula:


              that should make X the coordinate that centers the div:

              my implementation was:


              for some reason, in NS6 i didn't get the window width, so it defaulted to (0)

              my mainobj.w = 800

              so: mainCenterX=(0-800)/2 ... or -400, which promptly sent my div to the state of being half off the screen in negative space

              my line to capture the docBodyMax is:


              note that webClient is my browser info object i use to determine forking...

              in NS6, the above code returns (0)... is it a 'window' property or something like that? or what is it that returns the width of the window in NS6? (cuz Mozilla 1 renders fine)

              anyway, thanks for the help
              *Bites* -- I warned em ...


              • #8

                found it...


                i remember, i had to deal with the old browser incorrect interpretation of the box model, and shave off some pixels for v.4 browsers... and then forgot that NS6 uses the same call, without the need to shave @8?{o>

                man, i need to sleep more

                now everything works right !!

                btw, the zip file scripts are licensed under a license i'm working on, since its not done yet, u can use them if you want under the terms of the artistic license (for the pre-release versions, it works.) BUT the html file i need to keep my claws in for the time-being, so please don't go using it for anything for now... not that you'd want to
                *Bites* -- I warned em ...