PDA

View Full Version : Smooth Menu Navigation inside different folders



dmrgraphics.com
03-03-2009, 06:18 AM
1) Script Title: Smooth Menu Nav

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

3) Describe problem: I am using the Ajax version of this. Everything works great, except when I try and use the script inside a folder. I checked all my links in both the <head> of the page and ddsmoothmenu.js. Like I said works perfectly unless I have it inside a folder. Actually once I start trying to get it to work in a folder, it stops working on all the other pages.

Any thoughts?

Thanks,
Dave

Snookerman
03-03-2009, 06:30 AM
You must have some links that are broken. Could you post a link to your site so we can take a look?

dmrgraphics.com
03-03-2009, 01:11 PM
I figured out that, inside the ddsmoothmenu.init tag on the .js file, if I have the link as just "smoothmenu.htm" it will work fine in that directory, but won't find the file in another folder (makes sense, relative link). If I change this to be "http://www.basiclives.com/smoothmenu.htm" it no longer works on either page. There must be another place I need to change the link, I can't figure out where.

PAGES:
http://www.basiclives.com/index3.html

http://www.basiclives.com/resources/index2.htm (http://www.basiclives.com/resources/index2.htm)

http://www.basiclives.com/smoothmenu.htm

SCRIPTS
http://basiclives.com/ddsmoothmenu.css (http://www.basiclives.com/ddsmoothmenu.css)

http://basiclives.com/ddsmoothmenu.js (http://www.basiclives.com/ddsmoothmenu.js)

dmrgraphics.com
03-03-2009, 01:41 PM
I made did something that seems to work, I updated the smoothmenu.js with the following:

ddsmoothmenu.init({
mainmenuid: "smoothmenu-ajax",
//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"]
})

Instead of using an absolute path http://www..., I kept it as a relative path but made it "../../smoothmenu.htm" instead of just "smoothmenu.htm".

Vey
03-03-2009, 03:01 PM
I made did something that seems to work, I updated the smoothmenu.js with the following:

I kept it as a relative path but made it "../../smoothmenu.htm" instead of just "smoothmenu.htm".

I had a conflict between IE and Firefox.

When I was working on a page inside a folder where I had a scripts folder and the smoothmenu.htm page, the smoothmenu.js file couldn't find the htm page. I tried putting it in the scripts folder and in the main part of the folder, but it still couldn't find it using IE7 or 8

It worked fine for Firefox 3, but didn't work for IE. I put in a relative link into the smoothmenu.js file, back to the home folder and it found it with no trouble.

ddadmin
03-03-2009, 09:10 PM
Instead of specifying a relative path to smoothmenu.htm, which can be different depending on where the page showing the menu is:

contentsource: ["smoothcontainer", "../../smoothmenu.htm"] //"markup" or ["container_id", "path_to_menu_file"]

You can make a small change to the .js file that supports an absolute URL to it within your own domain:


contentsource: ["smoothcontainer", "http://www.mysite.com/smoothmenu.htm"] //"markup" or ["container_id", "path_to_menu_file"]

To do this, inside ddsmoothmenu.js, find the below line, and add to it the line in red:


var $headers=$mainmenu.find("ul").parent()
setting.contentsource[1]=setting.contentsource[1].replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/")

That should do it.

emarcus25
03-26-2009, 01:09 AM
Hi

I added smoothmenu to my site and its working well on IE, Chrome but it doesn't work on FF. Screen going white.
I don't know how to solve that problem.

http://www.galway.net.pl/poorclares/index.html