简体   繁体   English

如何在部分加载上绑定事件 Shopify

[英]How to bind an event on a section load Shopify

I would like to bind an event on shopify section load in admin I mean while working on the Customize theme .我想在 admin 中的 shopify 部分加载上绑定一个事件,我的意思是在处理Customize theme

For example working on slider in Shopify customizer.例如在 Shopify 定制器中处理滑块。 We might need some jQuery script that runs on the section load.我们可能需要一些在部分加载时运行的 jQuery 脚本。 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.我尝试了shopify:section:load事件,但没有成功。

Put it in section javascript tag把它放在 javascript 标签部分

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM