我想实现这个(dannyvankooten点com/jquery插件/ mapz /)图像平移脚本到Joomla文章。我在Joomla外测试了它(http://tylypahka.tk/karttatesting/),它的工作完美。但是,当我在Joomla文章中尝试时,平移不起作用(http://tylypahka.tk/kartta)。JavaScript不工作在Joomla文章
我把完全相同的代码放到Joomla模板的头,我已在测试版本:
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js" type="text/javascript"></script>
<script src="https://jquery-ui.googlecode.com/svn-history/r2596/branches/dev/spinner/external/mousewheel/jquery.mousewheel.min.js" type="text/javascript" ></script>
<script src="http://tylypahka.tk/js/jquery.mapz.js" type="text/javascript"></script>
<script type="text/javascript" src="http://tylypahka.tk/js/jquery.maphilight.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#map").mapz({
zoom : true,
createmaps : true,
mousewheel : true
});
});
</script>
<script type="text/javascript">$(function() {
$('.map').maphilight();
$('#squidheadlink').mouseover(function(e) {
$('#squidhead').mouseover();
}).mouseout(function(e) {
$('#squidhead').mouseout();
}).click(function(e) { e.preventDefault(); });
});</script>
<style>
.map-viewport{ position:relative; width:860px; height:883px; overflow:hidden; background-color:black;}
.level{ position:absolute; left:0; top:0; z-index:10;}
.current-level{ z-index:20; }
#map{ width:1297px; height:883px; position:absolute; left:0; top:0; cursor:move;}
</style>
而且完全相同的代码的文章:
<div class="map-viewport">
<div id="map">
<img src="http://img42.imageshack.us/img42/8954/tylypahkanportit.png" width="1297" height="883" usemap="#html-map" class="current-level level map" />
</div>
<map name="html-map">
<area id="squidhead" shape="rect" coords="311,494,434,634" href="http://www.image-maps.com/" alt="" title=""/>
</map>
</div>
jQuery的自动加载中的Joomla现场,所以它不应该是问题。任何想法我在这里做错了吗?
所有建议和帮助将非常感谢!
请检查您的模板是否实际上正在加载jQuery而不是MooTools。 MooTools也使用$()函数名称,这可能会导致您的代码停止工作。 – Hazzit 2013-03-02 15:23:14
是的,它正在加载jQuery。我根本没有在我的网站上使用MooTools,但是谢谢:) – Ilari 2013-03-02 17:56:54
你不使用MooTools的事实并不意味着它没有被加载,并且默认情况下它会阻止你使用jQuery和'$ '。检查错误控制台在萤火虫 – 2013-03-02 18:00:14