简体   繁体   English

在模式弹出窗口或load()之后加载jQuery插件

[英]Loading jQuery plugins after modal popup or load()

I am working on a project that have modal popup (I use Magnific Popup ) and Ajax loads. 我正在一个有模态弹出窗口(我使用Magnific Popup )和Ajax加载的项目中。

The problem is: everytime I call a modal or load something, my jQuery plugins (like iCheck or Tooltipster ) do not work, so I have to call them all (again) with callback. 问题是:每次我调用模式或加载某些东西时,我的jQuery插件(如iCheckTooltipster )都无法使用,因此我必须再次使用回调调用它们。

So, my question is: is there a way to do not have to open them again? 所以,我的问题是:有没有办法不必再次打开它们? A way that all plugins (or already runned functions) automatically run again, without I have to manually do this? 所有插件(或已运行的功能)自动再次运行的方式,而无需我手动执行此操作?

If I made a mistake or my text is a little bit confuse, feel free to suggest an edit. 如果我犯了一个错误或者我的文字有点混乱,请随时提出修改建议。 Perhaps there are technical words to describe better my problems. 也许有技术术语可以更好地描述我的问题。

Try to load your your files using require.js. 尝试使用require.js加载文件。 Require have an option that is possible specify The dependency of a file and you can also load it whenever you want without have problems like this that you are having. 需要有一个可以指定文件依赖项的选项,并且您还可以随时加载它,而不会遇到类似的问题。

Take a look in "shim" command here: 在这里查看“ shim”命令:

http://requirejs.org http://requirejs.org

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

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