Skip to content

Instantly share code, notes, and snippets.

@Sulcalibur
Forked from mhayes/README.md
Created August 21, 2013 00:11
Show Gist options
  • Save Sulcalibur/6288944 to your computer and use it in GitHub Desktop.
Save Sulcalibur/6288944 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