PDA

View Full Version : Smooth Navigational Menu v1.51, external file



Jacques Gourdon
07-29-2012, 06:51 PM
1) Script Title: Smooth Navigational Menu v1.51

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/ddsmoothmenu.htm

3) Describe problem: I want to put the menu in an external file. I think I followed the instructions but I can't get it to work.
I put the files there: http://photosjg.x10.mx/smoothmenu/
essais-InPage.html works fine but it's not what I want.
essais-External.html
If someone can look at the code and tell me what's wrong that wouls be wonderful.
Thanks a million.
jacques.gourdon@gmail.com

ddadmin
07-29-2012, 09:32 PM
Try removing the first two initialization codes (in gray) from your page, as you only have one menu on the page, mainly, the 3rd Ajax one:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<link rel="stylesheet" type="text/css" href="ddsmoothmenu.css" />

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="ddsmoothmenu.js">

/***********************************************
* Smooth Navigational Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

<script type="text/javascript">

ddsmoothmenu.init({
mainmenuid: "smoothmenu1", //menu DIV id
orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
classname: 'ddsmoothmenu', //class added to menu's outer DIV
//customtheme: ["#1c5a80", "#18374a"],
contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

ddsmoothmenu.init({
mainmenuid: "smoothmenu2", //Menu DIV id
orientation: 'v', //Horizontal or vertical menu: Set to "h" or "v"
classname: 'ddsmoothmenu-v', //class added to menu's outer DIV
//customtheme: ["#804000", "#482400"],
contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

ddsmoothmenu.init({
mainmenuid: "smoothmenu-ajax",
orientation: 'h',
classname: 'ddsmoothmenu',
customtheme: ["#1c5a80", "#18374a"], //override default menu CSS background values? Uncomment: ["normal_background", "hover_background"]
contentsource: ["smoothcontainer", "smoothmenu.htm"] //"markup" or ["container_id", "path_to_menu_file"]
})

</script>
</head>

<body>
<h2>Example 1</h2>
<div id="smoothcontainer">
<noscript>
<a href="link to site map for search engines and user with JS disabled">Site map</a>
</noscript>
</div>

</body>
</html>

Jacques Gourdon
07-31-2012, 05:17 PM
I looked into it a bit more. I took the http://www.dynamicdrive.com/dynamicindex1/ddsmoothmenu.htm file and edited out most of it to keep only the 3 menus, 2 inpages and one external.
Works fine:
http://photosjg.x10.mx/smoothmenu/externalfile.html

But if I suppress the div for one of the inpages, the external menu does not show.
http://photosjg.x10.mx/smoothmenu/externalfile-missingInternal.html

external menu not showing.
I want only the external.
Help please !
jacques.gourdon@gmail.com

Jacques Gourdon
07-31-2012, 05:25 PM
Fine, that does it.
Applied the change: http://photosjg.x10.mx/smoothmenu/externalfile-missingInternal.html

Super!
Now I'm in business.
IMHO it does not make much sense to have the code for the menu in all pages. In an external file, a change to that file applies to all the pages. That's the wway to do menus.

Thanks a million.