使用Gantry 4 Framework在Joomla 3.0上运行引导工具提示时遇到问题



我正在尝试启用Gantry 4中的引导工具提示。

引导程序javascript被加载为bootstrap.min.js和jquery。

在结束正文标记之前,我在index.php文件中添加了以下内容

<script type="text/javascript">
  $(document).ready(function () {
    $("[rel=tooltip]").tooltip();
  });
</script>

我似乎有一个冲突,因为我得到以下错误:

TypeError: 'undefined' is not a function (evaluating '$(document).ready(function () {
  $("[rel=tooltip]").tooltip();
})')

应该触发工具提示的文本是:

<a href="#" rel="tooltip" data-placement="top" data-original-title="Depuis le 1er juin 2004, la durée légale de la vie séparée a été réduite de quatre à deux ans.">le cas d&rsquo;un mariage de longue durée</a>

有人能指出我需要做些什么来解决这个问题吗?谢谢

很抱歉,我忘记添加链接到工具提示不起作用的网站和页面。

http://gobet.ergonomiq.net/divorce-s分居/离婚/26要求离婚

您在网站上激活了MooTools,因此$selector的工作方式与jQuery是主要的$selected代理时不同。您需要转换$的用法,其中jQuery应该使用jQuery。

示例:

$(selector here)

应该是:

jQuery(selector here)

其他一切都会好起来的。

确保只有一个jQuery库正在加载,并且它位于列表的顶部。如果没有,则bootstrap.min.js文件将无法工作。

如果这样做了,但仍然不起作用,请尝试添加这样的代码:

$document = JFactory::getDocument(); //remove is this line is already being used
$js = "$(document).ready(function(){
          $('[rel=tooltip]').tooltip();
       });";
$document->addScriptDeclaration($js);

希望这能有所帮助。

将引导程序框架添加到模板的component.php中:JHtml::_('脚踏板.框架'(;这应该可以解决

的".toolkit不是函数"错误
  1. 在Joomla项目中,打开templates/<your-template-name>/index.php
  2. 找到JHtml::_('behavior.framework', true);并将其注释掉

或者,您可以将单词behavior替换为bootstrap

最新更新