SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    PHP Otaku Gibb's Avatar
    Join Date
    Jul 2004
    Location
    Texas
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Odd Problem: Content length causing menu offset

    I've posted about this problem in the past, but I didnt understand how the problem was occuring and now I do.

    I'm using a CSS layout from one of the tutorial articles from this site (the butterfly one).

    I cleared out the existing css menu, leaving only the empty space for it and threw a DHTML menu (hvmenu v5.4.11 from DynamicDrive.com) on top of the space.

    As long as my content is less than 1 page, the menu will be perfectly centered. Once the content goes over a page, and the side scrolling bar appears, the menu (and only the menu) will get pushed 10 pixels to the right in Firefox and Opera. In IE the menu still remains centered. Both the css layout and the menu are set to be certered on the page, but the menu seems to center without taking into account the scrollbar (in firefox and opera only).

    Anybody have any idea why this happens, or how to fix it? I can post the code for the DHTML menu if that would help.

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Portsmouth UK
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ie and Moz consider the width of the page differently

    you must be using code to find the width

    in this code

    set a offset say 20 for Moz and 0 fof IE and use this in centering

  3. #3
    PHP Otaku Gibb's Avatar
    Join Date
    Jul 2004
    Location
    Texas
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah I stuck this block of code into my var assignment area for the DHTML menu:
    Code:
    if (navigator.userAgent.indexOf("MSIE") != -1) {
        var StartLeft=0;			// Menu offset y coordinate
    } else {
        var StartLeft=-10; 			// non IE browsers
    }
    That works fine when there is more than 1 page worth of content. Once the entire page is visible, the menu gets pushed 10 pixels to the left in Mozilla and Opera.

    Edit:

    I had some of the wording backwards, fixed now

  4. #4
    PHP Otaku Gibb's Avatar
    Join Date
    Jul 2004
    Location
    Texas
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe a better question would be this:

    Is there a way in JavaScript to determine whether the side scroll bar is present and feed a different value into the y-value offset in the DHTML menu?


Bookmarks

Posting Permissions

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