Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Springfield, IL USA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question 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 Attached Files
    *Bites* -- I warned em ...

  • #2
    New Coder
    Join Date
    Jun 2002
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    ciao
    Alberto http://www.unitedscripters.com/

  • #3
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    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
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Springfield, IL USA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    clarification

    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
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Springfield, IL USA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation 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

    thanx
    *Bites* -- I warned em ...

  • #6
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    The NS7 PR is based on Mozilla 1.0 RC3 I believe. Which is nearly identical to the Mozilla 1.0 release...

  • #7
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Springfield, IL USA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb 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:

    X=(A-B)/2

    that should make X the coordinate that centers the div:

    my implementation was:

    mainCenterX=(docBodyMaxX-mainobj.w)/2;

    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:

    docBodyMaxX=parseInt((webClient.isIE4||webClient.isNS4)&&document.body.innerWidth-20||document.body.clientWidth||0);

    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
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Springfield, IL USA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post ah

    found it...

    window.innerWidth



    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 ...


  •  

    Posting Permissions

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