Results 1 to 9 of 9

Thread: DropDown Menu

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2003
    Posts
    419

    DropDown Menu

    Hello, I downloaded a dropdown menu from pscode.com. Everything works fine, except at 800x600 resolution the horizontal menu isn't aligned. You can change the LEFT value in config.js. I was wondering, how could I have it set a different value if the users resolution is 800x600?
    Code:
    If LostAngel.Tag = "Programming" then
       LostAngel.Caption = "Awake"
    Else
       LostAngel.Caption = "Dreaming of Code"
    End If

  2. #2
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: DropDown Menu

    Well...

    Code:
    <script type="text/javascript">
      <!--
        var ScreenResolution = screen.availHeight + "x" + screen.availWidth;
        if (ScreenResolution = "800x600"){
          // Do somehting here....
        }
      //-->
    </script>
    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2003
    Posts
    419

    Re: DropDown Menu

    Thanks, one more question. If I were to set a tables Alignment to something depending on the Resolution, how would I do so?
    Code:
    If LostAngel.Tag = "Programming" then
       LostAngel.Caption = "Awake"
    Else
       LostAngel.Caption = "Dreaming of Code"
    End If

  4. #4
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: DropDown Menu

    Quote Originally Posted by LostAngel
    Thanks, one more question. If I were to set a tables Alignment to something depending on the Resolution, how would I do so?

    Use the above code and then access the tables style attribute and then set its align attribute to the desired value

    Or if you were refering to the left or right values you can access them in the same way

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: DropDown Menu

    Of course, the thing breaks if the user has a larger resolution and doesn't use his browser at full-screen. You might want to query the browser window size instead.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2003
    Posts
    419

    Re: DropDown Menu

    Thanks guys, hopefully this will be my last question for awhile. I notice that the page looks great in firefox...but in IE, the menu is missaligned. The following is the code I have for changing alignment based on resolution:
    VB Code:
    1. if (window.screen.width < 1024) {
    2. LEFT=110;
    3. }
    4. if (window.screen.width > 1020) {
    5. LEFT=250;
    6. }

    I know that navigator.appName returns your browser name, how can I have it detect if the browser is IE, if it's IE have it set the LEFT var based on resolution. And if it's Netscape, have it set LEFT var based on the resolution?
    Code:
    If LostAngel.Tag = "Programming" then
       LostAngel.Caption = "Awake"
    Else
       LostAngel.Caption = "Dreaming of Code"
    End If

  7. #7
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: DropDown Menu

    This will detect IE....

    Code:
    var Browser = navigator.userAgent.toLowerCase();
    if (Browser.search(/msie\s(\d+(\.?\d)*)/) != -1){
      // Yes this is IE...
    }
    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: DropDown Menu

    It might be Opera. It disguises as IE by default.

    Object tests are more effective. I believe that this code truly identifies IE, and only IE:
    Code:
    if(typeof(window.ActiveXObject) == "function")
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  9. #9
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: DropDown Menu

    Quote Originally Posted by CornedBee
    It might be Opera. It disguises as IE by default.

    Object tests are more effective. I believe that this code truly identifies IE, and only IE:
    Code:
    if(typeof(window.ActiveXObject) == "function")

    Indeed that does only work with IE as only IE used ActiveX technology

    I have never seen that one before - good job

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

Posting Permissions

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



Click Here to Expand Forum to Full Width