0
votes

I would like to bind an event on shopify section load in admin I mean while working on the Customize theme.

For example working on slider in Shopify customizer. We might need some jQuery script that runs on the section load. This should be called every time while we change anything from customizer.

I tried the shopify:section:load event but did not get any success.

1
shopify:section:load fires each time you modify the content in the customize panel. Why is this not working for you?drip
I used jQuery(document).on('shopify:section:load', sslider(event, this)); But it does not call function when I edit section from left menus. I have placed this code in theme.liquidSanjay Goswami
It's working for me: drive.google.com/file/d/1s-MF2PAWMwdzmVTuHORz_xTH8bnX5uGc/view This is the code in my index.liquid file: jQuery(document).on('shopify:section:load', function(){ console.log('event fired - doc') })drip
Thank you. I will try again and will share you the update.Sanjay Goswami
This is not working for meSanjay Goswami

1 Answers

0
votes

Put it in section javascript tag

{% javascript %}
function showAlert() {
  alert('listen to shopify theme editor re-render');
}

document.addEventListener("shopify:section:load", showAlert);
{% endjavascript %}