简体   繁体   English

jquery.js / whmcs集成

[英]jquery.js / whmcs integration

I have a problem with integrating my header and footer in whmcs. 我在whmcs中集成页眉和页脚时遇到问题。 Everything works perfectly. 一切正常。 Although a strange problem came along. 尽管出现了一个奇怪的问题。 It has something to do with the jquery.js file in my custom layout. 这与我的自定义布局中的jquery.js文件有关。

when I comment out the jquery.js in my footer.tpl the dropdown menu in the header does not work on pages where whmcs generates tables. 当我在footer.tpl中注释掉jquery.js时,标题中的下拉菜单在whmcs生成表的页面上不起作用。 (invoices and domains) But when I do use that jquery file the tables are still generated fine and the menus work, but then I can't order domains. (发票和域)但是当我确实使用该jquery文件时,表格仍然可以正常生成,并且菜单可以正常工作,但是后来我无法订购域。 No button or text fields appear when ordering a domain. 订购域时,没有按钮或文本字段出现。

I know this is not a good and a vague question but this has got me puzzled for quit a while now. 我知道这不是一个好问题,而且含糊不清,但是这让我困惑了一段时间。

Anyone with who can push me in the right direction to find a solution? 有谁可以推动我朝正确的方向寻找解决方案? Or someone with a similar experience with whmcs integration? 还是在whmcs集成方面具有类似经验的人?

thanks in advance!! 提前致谢!!

Not sure if you found a solution on this, but likely the culprit is one of two things: 不知道您是否找到了解决方案,但罪魁祸首可能是两件事之一:

1) The jquery library loading second is clobbering the first one so it no longer exists. 1)加载第二个的jQuery库正在破坏第一个,因此它不再存在。 To fix this you should call jQuery.noConflict(); 要解决这个问题,您应该调用jQuery.noConflict();。 prior to loading the second jquery library, this way the $ shortcut gets pushed over to use jQuery and frees up the $ for the new jquery. 在加载第二个jquery库之前,这种方式将$快捷方式推送到使用jQuery并释放$用于新的jquery。 This however may become a problem if any of the javascript relies on the $ shortcut and must point to the first jQuery library, in which case all shortcuts should be renamed to jQuery. 但是,如果任何JavaScript都依赖$快捷方式并且必须指向第一个jQuery库,则这可能会成为问题,在这种情况下,所有快捷方式都应重命名为jQuery。

2) The scripts executing the later jQuery library aren't compatible. 2)执行更高版本的jQuery库的脚本不兼容。 This can be problematic if the versions are very different as some methods and capabilities have changed over time. 如果版本非常不同,这可能会带来问题,因为某些方法和功能会随着时间而改变。

Best thing to do is always to use only one jQuery library, and use the newest one if possible. 最好的做法是始终仅使用一个jQuery库,并尽可能使用最新的jQuery库。 Older scripts that rely on the older jQuery should be updated if possible. 如果可能,应更新依赖于旧版jQuery的旧版脚本。

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

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