Results 1 to 4 of 4

Thread: Mega Menu in external file

  1. #1
    Join Date
    Jan 2008
    Posts
    72
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Mega Menu in external file

    1) Script Title: DD Mega Menu

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

    3) Describe problem:
    Can this menu alsp be modified to put the menu contents in an external file like with Smooth Menu ?


  2. #2
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    1.
    Follow the steps given at http://www.dynamicdrive.com/dynamici...ddmegamenu.htm for constructing a standalone menu. Let's call the file: menu.html.

    2.
    In menu.html, replace:
    Code:
    <script>
    ddmegamenu.docinit({
    	menuid:'solidmenu',
    	dur:200 //<--no comma after last setting
    })
    
    ddmegamenu.docinit({
    	menuid:'megaanchorlink',
    	dur:500,
    	easing:'easeInOutCirc' //<--no comma after last setting
    })
    </script>
    with:
    Code:
    <script type="text/javascript" src="init.js"></script>
    and create a file init.js containing the following lines:
    Code:
    ddmegamenu.docinit({
    	menuid:'solidmenu',
    	dur:200 //<--no comma after last setting
    })
    
    	
    ddmegamenu.docinit({
    	menuid:'megaanchorlink',
    	dur:500,
    	easing:'easeInOutCirc' //<--no comma after last setting
    })
    3.
    Also create a file include_menu.js and put the following lines in it:
    Code:
    function HttpRequest(url){
    var pageRequest = false //variable to hold ajax object
    /*@cc_on
    @if (@_jscript_version >= 5)
    try {
    pageRequest = new ActiveXObject("Msxml2.XMLHTTP")
    }
    catch (e){
    try {
    pageRequest = new ActiveXObject("Microsoft.XMLHTTP")
    }
    catch (e2){
    pageRequest = false
    }
    }
    @end
    
    @*/ if (!pageRequest && typeof XMLHttpRequest != 'undefined')
    pageRequest = new XMLHttpRequest()
    
    if (pageRequest){ //if pageRequest is not false
    pageRequest.open('GET', url, false) //get page synchronously
    pageRequest.send(null)
    document.write(pageRequest.responseText)
    
    }
    }
    4.
    Now in each file into which you want to insert the menu, put:
    Code:
    head:
    <script type="text/javascript" src="include_menu.js"></script>
    
    body (somewhere):
    <script type="text/javascript">HttpRequest('menu.html')</script>
    The files into which you insert the menu should have a valid doctype, for instance:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">


    Note that the arrows in the menu don't show if you are using IE. That's also the case at http://www.dynamicdrive.com/dynamici...ddmegamenu.htm
    ===
    Arie Molendijk.

  3. #3
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

  4. #4
    Join Date
    Jan 2008
    Posts
    72
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Many thanks, it works
    I have now a look to your second reply...

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
  •