简体   繁体   English

jQuery $(document).ready 在 phpfox 中不起作用

[英]jQuery $(document).ready didn't work in phpfox

I'm developing a PHPFox Module where I use a jQuery Plugin to paginate a serie of images.我正在开发一个 PHPFox 模块,我在其中使用 jQuery 插件对一系列图像进行分页。 When I access the module the plugin doesn't work, but the rest of the js code have no problem.当我访问模块时插件不起作用,但是js代码的rest没有问题。 The only code that doesn't work is which is placed inside the $(document).ready event.唯一不起作用的代码是放在$(document).ready事件中的代码。 If I refresh the page the plugin starts to work.如果我刷新页面,插件就会开始工作。

I think the problem is caused for the cache of the CMS, because the DOM isn't reloaded when I load the Module.我认为问题是由 CMS 的缓存引起的,因为当我加载模块时 DOM 没有重新加载。 I tried to change de $(document).ready for window.onload but I've the same problem.我试图将 de $(document).ready更改为window.onload但我遇到了同样的问题。

Could somebody help me?有人可以帮帮我吗?

Finally I've find the solution:最后我找到了解决方案:

To use jQuery functions on load in phpfox you must use the sintax $Behaviour.onLoadEvents = function(){rest of the code} insted of the traditional and standar $(document).ready要在 phpfox 中加载时使用 jQuery 函数,您必须使用传统和标准$(document).ready的语法$Behaviour.onLoadEvents = function(){rest of the code} insted

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

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