【问题标题】:How to include jquery to joomla2.5 article如何将 jquery 包含到 joomla 2.5 文章中
【发布时间】:2013-08-28 18:38:29
【问题描述】:

我正在使用 joomla2.5,我需要在我的一个页面(不是主页)上有一个 jquery 效果,所以我想知道我是否可以将 jquery 包含到 joomla 文章中,如果没有,我该怎么办?

【问题讨论】:

    标签: jquery joomla2.5 joomla-extensions joomla1.7 joomla3.0


    【解决方案1】:

    您可以在模板中使用addscript函数在head部分加载jquery。

    <?php
    $document = JFactory::getDocument();
    $document->addScript('/media/system/js/sample.js');
    ?>
    

    但请注意,您必须使用noConflict 函数,因为joomla 有时会使用mootools 框架。

    【讨论】:

    • 我需要在文章中包含 jquery 只是因为我不想在 index.php 上显示它可以吗?
    • 当然你只需要安装jumi 允许在文章中使用 php 然后在我的回答中使用脚本
    【解决方案2】:

    您可以在&lt;head&gt; 部分的 index.php 中包含 jquery。

    【讨论】:

      猜你喜欢
      • 2017-02-18
      • 2013-03-09
      • 1970-01-01
      • 1970-01-01
      • 2012-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-15
      相关资源
      最近更新 更多