CottageLabs / edges

Data query, manipulation, search and visualisation front-end library
MIT License
8 stars 7 forks source link

use jQuery noConflict() or avoid $ - whichever is best #6

Open richard-jones opened 6 years ago

richard-jones commented 6 years ago

For embedding Edges in 3rd party sites, we'll need to think a bit more carefully about how we use $. Some sites don't automatically set this to jQuery, and others use a noConflict mode, so $ can't always be relied upon to be there, and can sometimes also disappear at random if another library calls $.noConflict.

Not sure what the best solution is right now. Workaround is

jQuery(document).ready(function($) {
    window.$||(window.$=jQuery);
    // start up your edges
}

Provided this doesn't mess with the site's existing $