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

Error with jQuery noConflict mode #11

Closed
jasonhinkle opened this issue Apr 29, 2014 · 6 comments
Closed

Error with jQuery noConflict mode #11

jasonhinkle opened this issue Apr 29, 2014 · 6 comments
Labels

Comments

@jasonhinkle
Copy link

The Page-wide options defaults are being set using $ which breaks in jQuery noConflict mode. I replaced:

$.fn.velocity.defaults = {

with

jQuery.fn.velocity.defaults = {

That seems to work find in noConflict mode as far as I can tell.

@julianshapiro
Copy link
Owner

Silly me. Great find. Thanks so much, Jason. Will update in a moment.

@janwerkhoven
Copy link

Hi I have to use jQuery.noConflict which causes jQuery(...).velocity is not a function errors.

var $hd = jQuery.noConflict();
...
$hd(...).velocity({...}) // results in "Velocity is not a function"
jQuery(...).velocity({...}) // results in "Velocity is not a function"

I'm loading velocity 1.2.3 after jQuery 1.11.2

Any ideas?

@kokarn
Copy link

kokarn commented Mar 7, 2016

You are loading velocity before jQuery, do it in the reverse order and you
should be fine.

On Mon, Mar 7, 2016 at 8:43 AM Jan Werkhoven [email protected]
wrote:

Hi I have to use jQuery.noConflict which causes jQuery(...).velocity is
not a function errors.

var $hd = jQuery.noConflict();
...
$hd(...).velocity({...}) // results in "Velocity is not a function"
jQuery(...).velocity({...}) // results in "Velocity is not a function"

I'm loading velocity 1.2.3 before jQuery 1.11.2

Any ideas?


Reply to this email directly or view it on GitHub
#11 (comment)
.

@janwerkhoven
Copy link

Sorry that was a typo. I do load velocity after jQuery...

screen shot 2016-03-07 at 6 50 15 pm

@kokarn
Copy link

kokarn commented Mar 7, 2016

We are using that at work with a jsDelivr link (https://cdn.jsdelivr.net/g/[email protected],[email protected]) and then something like this

ourGlobal.$ = $.noConflict();
jQuery = $;

( function( $ ){
    'use strict';

    $( '.js-element' ).velocity( 'fadeIn' );
})( ourGlobal.$ );

Can you show more of your code?

@janwerkhoven
Copy link

That's a good trick, that way I don't have to use $hd everywhere.

I replaced all $hd with plain jQuery $ and I still keep getting "Velocity is not a function..." errors. The issue is thus not related to the noConflict. Probably a compilation issue?

Rycochet pushed a commit that referenced this issue Aug 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants