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

Already on GitHub? Sign in to your account

Javascript conflicting #49

Closed
wpninja-1 opened this Issue Nov 8, 2012 · 8 comments

Comments

Projects
None yet
6 participants

This in the functions.php
// Load JavaScripts
wp_enqueue_script( 'foundation', get_template_directory_uri() . '/javascripts/foundation.min.js', array(), '1.0', true );

was affecting this plugin
https://usabilitydynamics.com/products/wp-property/forum/topic/getting-javascript-error-on-this-page-preventing-it-from-displaying-the-dynamic-map/

I just commented it out for now

Give this a try:
before that line, put
wp_deregister_script('jquery');

then edit the line to replace 'foundation' with 'jquery' see if that helps.

Owner

drewsymo commented Feb 17, 2013

Am investigating this now,

Can you please let me know what JS errors you see in your browser by using Inspector Tools or similar?

Contributor

Shelob9 commented Feb 17, 2013

The stock foundation.min.js includes jQuery in it, which causes compatibility issues with anything that uses jQuery. I have a version without jQuery (https://gist.github.com/Shelob9/4569861). I use this along with WordPress' built in jQuery library and I have no compatibility issues with WordPress plugins or any other jQuery plugibs I add to my themes.

Owner

drewsymo commented Feb 17, 2013

Hey @Shelob9,

Thanks for the heads up.

Will remove the built-in JQ tonight from foundation.min.js and enqueue jQuery as a replacement.

Believe this has also been causing issues with Modernizr initialising properly.

@drewsymo drewsymo was assigned Feb 17, 2013

maxcr commented Feb 17, 2013

LOL. I've been/was working on my own port of Foundation for wordpress and this was the first issue I had, and I fixed it the same day. Good to know that as a novice developer I'm pretty good at troubleshooting. 👯

I've forked your version, and am going to be using that for now drewsymo.

Contributor

Shelob9 commented Feb 18, 2013

@drewsymo Just looking at some of my different themes and I realize some times I did wp_enqueue_script('jquery'); before enqueueing foundation's js in my functions file. and sometimes I didn't and it doesn't seem to make a difference.

apsolut commented Feb 20, 2013

I also had a problems with plugins - installed from wp/plugins (the tab plugin, WP UI, accordion jquery etc, even if i load in noConflict or replace $ with jQuery).. i loaded them somehow but its a big issue.

suggestion: Also can we add to this master by default- that jquery loads inside the header and footer?

//header
wp_register_script( 'modernizr', get_template_directory_uri() . '/js/modernizr.foundation.js', array( 'jquery' ) );
wp_enqueue_script( 'modernizr' )

//footer
wp_register_script( 'foundation', get_template_directory_uri() . '/js/foundation.min.js', array( 'jquery' ), false, true );
wp_enqueue_script( 'foundation' );

Owner

drewsymo commented Apr 10, 2013

This has been fixed in the v4 branch:
https://github.com/drewsymo/foundation/tree/4.0

Thanks!

@drewsymo drewsymo closed this Apr 10, 2013

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