jQuery slideToggle不适用于joomla,但适用于jsbin
所以我有一个网站,我想使用jQuery slideToggle
来移动块.问题是它在我的Joomla网站上不起作用.但是,当我将代码复制到jsbin.com时,它可以工作.这是链接 http://jsbin.com/EcObOwex/1/edit
这是我正在使用的实际JS:
So I have a website and I want to use the jQuery slideToggle
to move the blocks. The problem is that it doesn't work on my Joomla website. However, when I copy the code to jsbin.com, it works. Here's the link http://jsbin.com/EcObOwex/1/edit
Here's the actual JS I'm using:
$('.sTurinys').hover(function(){
$('.ssTurinys',(this)).stop().slideToggle(600);
});
我不知道我还能提供什么其他信息. JS代码位于splash.js中,指向它的链接可以正常工作(检查一下,该文件中还有其他脚本可以工作)
I don't know what additional information I can provide. The JS code is in splash.js, link to it works properly (checked it, there's some other script that works from the file)
我被告知这是我遇到的JS错误.
这是错误
Uncaught TypeError: Object [object Object] has no method 'tooltip'
这是代码.谁能帮我确定这是什么吗?
I was informed that it was an JS error that I was getting.
Here's the error
Uncaught TypeError: Object [object Object] has no method 'tooltip'
And here's the code. Could anyone help me determine what is it?
<script type="text/javascript">
window.addEvent('load', function() {
new JCaption('img.caption');
});
jQuery(document).ready(function()
{
jQuery('.hasTooltip').tooltip({"container": false});
});
我没有手动添加它,它是<jdoc:include type="head" />
的一部分.谁能帮助我确定如何摆脱这段代码?
I didn't add it manually, it's part of the <jdoc:include type="head" />
. Could anyone help me determine how to shake this code off?
一些更多的信息:
这是我完整的<head>
代码. http://jsbin.com/aFOZEWI/2/edit
您还可以在Bin的JavaScript部分中找到完整的SPLASH.JS.
P.S. splash.js的另一部分有效,我的溢出元素按预期更改.
EDIT 2:
Some more information:
Here's my full <head>
code. http://jsbin.com/aFOZEWI/2/edit
AND YOU CAN ALSO FIND THE FULL SPLASH.JS in the JavaScript part of the Bin.
P.S. The other part of the splash.js works, my overflow element changes just as it's intended.
您可能导入了多个jQuery库,这可能会导致冲突.除此之外,让我们导入脚本并使用Joomla编码标准向您添加代码.
It might be possible that you have multiple jQuery libraries being imported which may cause conflicts. In addition to that, let's import the scripts and add you code using Joomla coding standards.
<?php
JHtml::_('jquery.framework'); //This calls jQuery in noConflict mode
$doc = JFactory::getDocument();
$doc->addScript(JUri::root() . 'templates/vabankbroker/src/splash.js');
$doc->addScriptDeclaration("
$('.sTurinys').hover(function(){
$('.ssTurinys',(this)).stop().slideToggle(600);
});
");
?>
对于工具提示错误,请打开模板的index.php,如果以下内容不存在,建议您添加它:
As for the Tooltip error, open the index.php of your template and if the following doesn't exist, I would recommend you add it:
JHtml::_('bootstrap.framework');
希望这会有所帮助