Skip to content

Instantly share code, notes, and snippets.

@wastemobile
Forked from mhayes/README.md
Created September 3, 2013 15:08
Show Gist options
  • Save wastemobile/6425176 to your computer and use it in GitHub Desktop.
Save wastemobile/6425176 to your computer and use it in GitHub Desktop.

Enabling noConflict mode

Using a default Foundation download you'll see some code like this:

<script>
document.write('<script src=' +
('__proto__' in {} ? 'js/vendor/zepto' : 'js/vendor/jquery') +
'.js><\/script>')
</script>

The first thing you'll want to do is disable Zepto, and just depend on jQuery. So replace that line with:

<script src="js/vendor/jquery.js"></script>

Then you'll want to enable noConflict mode and initialize Foundation using jQuery instead of $ like so:

<script>
  jQuery.noConflict();
  jQuery(document).foundation();
</script>

So once again, the resulting code should look like this:

<script src="js/vendor/jquery.js"></script>
<script src="js/foundation.min.js"></script>
<script>
  jQuery.noConflict();
  jQuery(document).foundation();
</script>

That's it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment