Results 1 to 3 of 3

Thread: Top Navigational Bar II - Centering Help

  1. #1
    Join Date
    Feb 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Top Navigational Bar II - Centering Help

    Top Navigational Bar II
    http://www.dynamicdrive.com/dynamicindex1/topnavbar.htm

    Since I didn't start the other post, and it looks to be drying up, I'll start over.

    I can't seem to center the headings inside the nav boxes. The in-script comments say to uncomment in this one place to center the bar. The help on the DD page says that should center the bar as well as the individual headers. No matter what I try, the headers themselves will not center, though the bar itself is centered.

    BTW, I'm using "navcond.js" vs. "dhtmllib.js" and "navbar.js", in case that makes a difference.

    Any help would be appreciated...thanks!

    =jb=
    Last edited by sirjakeyjake; 02-10-2005 at 02:45 AM.

  2. #2
    Join Date
    Jan 2005
    Location
    Seattle
    Posts
    53
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    hmm...this is an old script.

    try this to center the menu on a page, change your init() function to:


    function init() {

    // Get width of window, need to account for scrollbar width in Netscape.

    fullWidth = getWindowWidth()
    - (isMinNS4 && getWindowHeight() < getPageHeight() ? 16 : 0);

    myNavBar1.resize(770);
    myNavBar1.create();
    myNavBar1.setzIndex(2);
    //UNCOMMENT BELOW LINE TO MOVE MENU DOWN

    // myNavBar1.resize(fullWidth); may be able to substitute a number like 500 for fullWidth ... without this line, the bar does not stretch across the entire screen...it uses the minimum needed as called from the size of the main menu choices
    var menuWidth = myNavBar1.getWidth();
    if(document.all){
    var x = document.body.scrollLeft+document.body.clientWidth/2-menuWidth/2
    }
    else
    if(document.layers){
    var x = pageXOffset+window.innerWidth/2-menuWidth/2
    }

    myNavBar1.moveTo(x,125);
    }




    to center the menu item:
    dhtmlMenu.addItem(new NavBarMenuItem("<center>News</center>", ""));
    Last edited by speedracer; 02-10-2005 at 09:48 AM.

  3. #3
    Join Date
    Feb 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by speedracer
    to center the menu item:
    dhtmlMenu.addItem(new NavBarMenuItem("<center>News</center>", ""));
    PERFECT!!! This is exactly what I needed. And so stupidly-simple...

    Thank you!

    =jb=

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
  •