8 Replies - 2145 Views - Last Post: 11 December 2012 - 05:29 PM

#1 alex71385  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 74
  • Joined: 27-October 09

Navigation menu not expanding

Posted 11 December 2012 - 03:29 PM

Good afternoon,

I created a menu using a tutorial, but for some reason it's not expanding, can someone take a look and help me figure out why please? Thank you!

http://casadecruz.hostei.com
Is This A Good Question/Topic? 0
  • +

Replies To: Navigation menu not expanding

#2 Dormilich  Icon User is online

  • 痛覚残留
  • member icon

Reputation: 3485
  • View blog
  • Posts: 10,046
  • Joined: 08-June 10

Re: Navigation menu not expanding

Posted 11 December 2012 - 03:41 PM

have a look at the error console, there are 3 serious CSS errors.

and 1 Java​Script error.
Was This Post Helpful? 1
  • +
  • -

#3 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3712
  • View blog
  • Posts: 5,964
  • Joined: 08-June 10

Re: Navigation menu not expanding

Posted 11 December 2012 - 03:46 PM

Hey.

Firefox is showing me the following error:
Timestamp: 11.12.2012 22:44:21
Error: TypeError: $mainmenu.parent(...).get(...) is undefined
Source File: http://casadecruz.hostei.com/menu/dacamenu.js
Line: 36


It seems that the $mainmenu.parent() call isn't returning any results. The first thing I'd suggest is using jQuery to set the class name, instead of using get() to retrieve the DOM element and set it the old fashion way. (Why not use jQuery, since you already have it loaded.)
$mainmenu.parent().addClass(setting.classname || "dacamenu");


You can also chain .removeClass() in before the .addClass() if you want to clear any other classes out of the element first. If you pass it without parameters, it'll remove everything.
Was This Post Helpful? 1
  • +
  • -

#4 alex71385  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 74
  • Joined: 27-October 09

Re: Navigation menu not expanding

Posted 11 December 2012 - 03:53 PM

I fixed the } issue, not understanding the float issue and then something about the javascript file popped up too?

View PostAtli, on 11 December 2012 - 03:46 PM, said:

Hey.

Firefox is showing me the following error:
Timestamp: 11.12.2012 22:44:21
Error: TypeError: $mainmenu.parent(...).get(...) is undefined
Source File: http://casadecruz.hostei.com/menu/dacamenu.js
Line: 36


It seems that the $mainmenu.parent() call isn't returning any results. The first thing I'd suggest is using jQuery to set the class name, instead of using get() to retrieve the DOM element and set it the old fashion way. (Why not use jQuery, since you already have it loaded.)
$mainmenu.parent().addClass(setting.classname || "dacamenu");


You can also chain .removeClass() in before the .addClass() if you want to clear any other classes out of the element first. If you pass it without parameters, it'll remove everything.


I replaced that line with the above line you provided but now i'm getting these:

Timestamp: 12/11/2012 4:51:25 PM
Error: The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature.
Source File: file:///C:/Users/Sasha/DACA/dacamenu.js
Line: 0

Timestamp: 12/11/2012 4:51:31 PM
Error: TypeError: dacamenu is undefined
Source File: http://casadecruz.ho...enu/dacamenu.js
Line: 105
Was This Post Helpful? 0
  • +
  • -

#5 Dormilich  Icon User is online

  • 痛覚残留
  • member icon

Reputation: 3485
  • View blog
  • Posts: 10,046
  • Joined: 08-June 10

Re: Navigation menu not expanding

Posted 11 December 2012 - 04:11 PM

View Postalex71385, on 11 December 2012 - 11:53 PM, said:

not understanding the float issue

center is not a valid value for float. you can only float left or right. (everything else doesn’t make sense, implementation-wise)
Was This Post Helpful? 0
  • +
  • -

#6 alex71385  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 74
  • Joined: 27-October 09

Re: Navigation menu not expanding

Posted 11 December 2012 - 04:14 PM

Ah, ok. What about the .js errors?
Was This Post Helpful? 0
  • +
  • -

#7 Dormilich  Icon User is online

  • 痛覚残留
  • member icon

Reputation: 3485
  • View blog
  • Posts: 10,046
  • Joined: 08-June 10

Re: Navigation menu not expanding

Posted 11 December 2012 - 04:22 PM

it might be an ASI issue, but my browser still reports the error on line 36.

This post has been edited by Dormilich: 11 December 2012 - 04:31 PM

Was This Post Helpful? 0
  • +
  • -

#8 alex71385  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 74
  • Joined: 27-October 09

Re: Navigation menu not expanding

Posted 11 December 2012 - 04:55 PM

My google search for ASI has failed me, can you please expand further?
Was This Post Helpful? 0
  • +
  • -

#9 Dormilich  Icon User is online

  • 痛覚残留
  • member icon

Reputation: 3485
  • View blog
  • Posts: 10,046
  • Joined: 08-June 10

Re: Navigation menu not expanding

Posted 11 December 2012 - 05:29 PM

ASI - (as the acronym above said) Automatic Semi-colon Insertion. If you don’t set the statement-terminating semi-colons yourself, Java​Script will do it for you—which may lead to unexpected results.


one prime example being
var foo = (function()
{
  var x = Date.now(); // or any other code
  return
  {
    bar: x
  };
}());

console.log(foo.bar); // Error, foo is null or not an object
console.log(foo);     // undefined



PS. please do not open new threads for the same topic.

This post has been edited by Dormilich: 11 December 2012 - 05:30 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1