Hi there,
I retrieve a Shopify Theme of a developer who left the company (so no explanation) where I'm currently working now and I'm chasing bug that I didn't create.
In my store I have buildify installed that is loading JQuery (buildify.assets.liquid)
<script type="text/javascript" id="buildify_no_conflict_jquery">
window.___$ = (typeof $ !== "undefined") ? $.noConflict() : false;
window.___jQuery = (typeof jQuery !== "undefined") ? jQuery.noConflict() : false;
</script>
{{ 'https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js' | script_tag }}
{{ 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js' | script_tag }}
<script type="text/javascript" id="buildify_no_conflict_jquery">
window.$b_jQuery = jQuery;
window.BuildifyTheme = {
'money_format': {{ shop.money_format | json }},
'money_with_currency_format': {{ shop.money_with_currency_format | json }},
'secure_url': {{ shop.secure_url | json }}
};
window.$ = window.___$;
window.jQuery = window.___jQuery;
</script>
In my theme.liquid.js file I also have a load of JQuery :
<html lang="{{ shop.locale }}">
<head>
{% include 'elevar-head' %}
{% render 'orbislabs_sitemap_noindex' %}
{% include 'shop-sheriff-amp' %}
<script async src="{{ 'jquery.min.js' | asset_url }}"></script>
later at the end of the body between 2 scripts :
{% include 'buildify-assets' %}
First weird behaviour : sometimes when I reload the home page : I have a bunch of errors that seems to be linked to JQuery :
The other weird behaviour appears on the collections page where I try to install infinite scroll. I got the following error randomly, it seems to depend on whether one JQuery or the other is loaded :
I'm a bit lost with the good way to use JQuery. It seems that loading 2 times JQuery is a bad Idea but what I understand of the buildify loading of JQuery is that it's in no conflict mode.
Does someone has faced this kind of issue ?
User | Count |
---|---|
26 | |
20 | |
11 | |
11 | |
9 |