Results 1 to 2 of 2

Thread: anylink css - set menu width in javascript?

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

    Default anylink css - set menu width in javascript?

    1) Script Title: AnyLink CSS Menu

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

    3) Describe problem: Currently the menu width must be set within the DIV or the CSS file as a style. Can the script be modified to set the menu width in the javascript like the AnyLink Drop Down Menu does? (AnyLink Drop Down Menu URL - http://www.dynamicdrive.com/dynamici...pmenuindex.htm)

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Sure, just use the attached modified anylink.js file. With it, you can both specify a default menu width inside the .js file, and optionally for a particular drop down menu, a different width inline within the onMouseover code in the HTML:

    Code:
    <!--1st anchor link and menu -->
    
    <a href="http://www.dynamicdrive.com" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, 'anylinkmenu1', '150px')">Anchor Link</a>   
                                                        
    <div id="anylinkmenu1" class="anylinkcss">
    
    <a href="http://www.dynamicdrive.com/">Dynamic Drive</a>
    <a href="http://www.cssdrive.com">CSS Drive</a>
    <a href="http://www.javascriptkit.com">JavaScript Kit</a>
    <a href="http://www.codingforums.com">Coding Forums</a>
    <a href="http://www.javascriptkit.com/jsref/">JavaScript Reference</a>
    
    </div>
    
    <!--2nd anchor link and menu -->
    
     <a href="http://www.dynamicdrive.com" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, 'anylinkmenu2')">Anchor Link 2</a>   
                                                        
    <div id="anylinkmenu2" class="anylinkcss" style="background-color: lightyellow">
    
    <a href="http://www.cnn.com/">CNN</a>
    <a href="http://www.msnbc.com">MSNBC</a>
    <a href="http://www.google.com">Google</a>
    <a href="http://news.bbc.co.uk">BBC News</a>
    
    </div>
    Here the 1st drop down is explicitly set to 150px, while the 2nd drop down, with no 4th parameter specified, will default to '200px', or what's set at the top of the .js file.

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
  •