View Full Version : Smooth navigational Menu javascript error

05-15-2009, 11:00 PM
1) Script Title: Smooth Navigational Menu (v1.3)

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

3) Describe problem: I have installed the smooth navigational menu on a website. I am getting this javascript error:

$mainmenu.parent().get(0) is undefined

in both IE and Firefox. I can see the menu and the dropdowns are working, but it won't click to other pages. In fact, there is an iframe in the main body area and it is not displaying the content even on the home page.

Is this because it is .asp? I have tried using an external file for the menu and that removed the dropdowns.


05-16-2009, 06:55 PM
I am getting the same error here:

I hope there is a solution.....


05-19-2009, 08:01 PM
I am too getting this error.

In FF 3.0.10 the menu works but shows this error in the error console

Error: $mainmenu.parent().get(0) is undefined
Source File: http://localhost/New/js/ddsmoothmenu.js
Line: 47

In IE8 the yellow error triangle appears in the bottom left of the browser window. Looking at the error it shows this

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
Timestamp: Tue, 19 May 2009 19:58:23 UTC

Message: 'parent().get(...)' is null or not an object
Line: 47
Char: 2
Code: 0
URI: http://localhost/New/js/ddsmoothmenu.js

05-21-2009, 04:37 AM
has anyone figured out why this error is happening or if there is a fix? thanks!


05-21-2009, 04:44 AM
the fix for this is ridiculously easy. all you have to do is remove
the extraneous .init function. if you are using ONLY the horizontal
menu, remove the "v" one. if not, remove the "h" one. simple as that.

wow, what a silly mistake! :D

<script type="text/javascript">

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"]

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"]


07-21-2009, 04:54 AM
unfortunately, this fix isn't working for me. i had already removed the init for the horizontal menu. i didn't experience any errors until i upgraded to IE8 and now i'm getting the following...

Line: 47
Error: 'parent().get(...)' is null or not an object

any ideas?

08-07-2009, 09:26 PM
FWIW, I had the same issue and removing the extra init call worked for me. Thanks rastafari!!

08-13-2009, 06:08 PM
I am also having the same problem and I realised that the error is coming because I am not using the smooth menu on some pages but the init function is defined in the template. so this is causing it, I am not using the navigation on some pages but as the function init is included in the template.......is there any fix for this...

08-30-2010, 09:35 AM
hi guys

if you are using this with joomla then you should make sure generated menu code doesnt has any style to it

here is an example
normally menu include looks like this

<jdoc:include type="modules" name="top-menu" style="xhtml" />

inorder to use this with joomla it should be

<jdoc:include type="modules" name="top-menu" style="none" />

hope this helps


11-09-2010, 05:41 PM
rastafari's answer above worked for me

had the "null or is not an object" error in IE

I was only using the horizontal menu so got rid of the vertical menu code in the JS and its now resolved.