Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simply can't get it to work #10

Closed
KennethDanielsen opened this issue Feb 17, 2013 · 4 comments
Closed

Simply can't get it to work #10

KennethDanielsen opened this issue Feb 17, 2013 · 4 comments

Comments

@KennethDanielsen
Copy link

Hi Lukasz,

I just can't get selectnav to work. I've installed it on my demosite and it just won't work. I've walked through the 4 steps like 20 times, to make sure I did not mess it up. But I named the nav id="nav", I the CSS (both default and mobile), loaded the script (tried with the DOM ready, without the DOM, and at the bottom of the site).

It still won't work as it still shows the original menu. It seems like it doesn't apply the class to menu. Check it out at http://kennethdanielsen.dk/new/index.html and tell me what I do wrong.

Thanks in advance!

  • Kenneth
@lukaszfiszer
Copy link
Owner

Hi Kenneth,

If you look into the JS console of your website, you will something like this: ReferenceError: domready is not defined - this is because you have wrapper selectnav in domready() function, but forgot to include domready itself. You either need to include this script into your website, either initialize selectnav without the domready wrapper at the bottom of your website.

Hope this helps

@KennethDanielsen
Copy link
Author

Hi Lukasz,

Thanks a lot for the quick reply!

Okay didn't know that. I'll try adding the domready script to the site. Regarding the last option, how do I initialize selectnav at the bottom? Do you mean at the bottom of the header, body or what?

@lukaszfiszer
Copy link
Owner

You can paste the following code just before the closing of your <body> tag:

   ...
  <script src="selectnav.min.js"></script>
  <script>selectnav('nav');</script>
</body>

This way you're sure that the script will be initialized after the browser parsed the rest the document (including your 'nav' element, which is the only one that actually counts here), which has basically the same effet as calling domready() at the top of the document.

You can learn more about the two techniques here:
http://stackoverflow.com/questions/6026645/document-readyfunction-vs-script-at-the-bottom-of-page
http://stackoverflow.com/questions/855077/does-putting-scripts-on-the-bottom-of-a-web-page-speed-up-page-load

@KennethDanielsen
Copy link
Author

Awesome - thanks a lot for great support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants