Results 1 to 8 of 8

Thread: Scrollable Menu Links causes horizontal scrollbar

  1. #1
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Scrollable Menu Links causes horizontal scrollbar

    1) Script Title: Scrollable Menu Links

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...rollerlink.htm

    3) Describe problem: When the amount of links increases it causes a horizontal scrollbar in the browser window. This is because the script calculates the actual width of the amount of links you desire by first writing them to a <span></span>, and the span causes the horizontal scrollbar.

    Is there any work-around for this? Or is there a similiar script that does not have this problem?

    Any help is very much appreciated.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You are referring to this line:

    Code:
    document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-5000">'+menucontents+'</span>')
    left:-5000 should be more than enough to prevent this problem. However, with a valid DOCTYPE most browsers will ignore both the top and left coordinates because no units are specified.

    The line should be:

    Code:
    document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-5000px">'+menucontents+'</span>');
    If you have more than 5000px worth of links, the number 5000 may be increased. If you need more help:

    Please post a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    reaperxt (07-06-2008)

  4. #3
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks very much!, It works like a charm now. I did find it weird that the browser was ignoring the -5000, but i completley overlooked that it did not have the px .

    Thanks again for the fast and very helpful reply!

  5. #4
    Join Date
    Aug 2008
    Posts
    13
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    hi

    i had this same problem in IE and the above fixed it thanks, but when i checked in opera the same problem occurs it causes the horizontal scroll bar. Any ideas?

    thanks

  6. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by webwonder View Post
    hi

    i had this same problem in IE and the above fixed it thanks, but when i checked in opera the same problem occurs it causes the horizontal scroll bar. Any ideas?

    thanks
    The demo page in Opera doesn't do that for me. Does it for you? I recall older versions of Opera sometimes needing a container with overflow hidden to prevent the horizontal scrollbar in similar situations, what version of Opera are you using? In any case, I would have to see it to tell for sure what the problem is and what might be done about it:

    Please post a link to the page on your site that contains the problematic code so we can check it out.


    But please be sure to tell me what version of Opera you are using.

    Edit: I just tried in Opera 9.52, even with a scrolling menu that caused a horizontal scrollbar, with the fix there was no problem.
    Last edited by jscheuer1; 08-10-2008 at 09:58 AM. Reason: add info
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #6
    Join Date
    Aug 2008
    Posts
    13
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    the site is at http://nbyrne.co.uk/geddes/index.html version of Opera 8.52.

    i also have noticed that in firefox and ie the menu lines ups but in opera it didnt i just tried taking padding of the links and this does alter the width of the menu so i guess i will have to put spaces in the menu itself, but this does not stop the horizontal scroll bar,

    thanks

  8. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Why are you using such an old version of Opera? Anyone who uses Opera as their primary browser would be using a more recent version. I said I had 9.52, but it is actually 9.51. Anyways, your page is just fine in it.

    You could try doing:

    Code:
    document.write('<div style="visibility:hidden;overflow:hidden;width:100px;position:absolute;"><span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-5000px;">'+menucontents+'</span></div>')
    But it might mess things up in other browsers, even in Opera 8.52. My advice would be to stick with the current fix outlined earlier in this thread and just upgrade to a later Opera version, as I say - folks using it as their primary browser will have the latest, or at least a more recent version that doesn't have this problem.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. The Following User Says Thank You to jscheuer1 For This Useful Post:

    webwonder (08-10-2008)

  10. #8
    Join Date
    Aug 2008
    Posts
    13
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    ok thanks, i dont use opera as primary browser thats firefox 3, i test in others and have latest opera at work as im at home and only tested here - i keep the older versions of browsers so i can test on different versions - if that makes sense.

    thanks for your help

    nikki

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
  •