【发布时间】:2013-02-17 00:49:16
【问题描述】:
我正在尝试将这个 (dannyvankooten dot com/jquery-plugins/mapz/) 图像平移脚本实现到 Joomla 文章中。我在 Joomla (http://tylypahka.tk/karttatesting/) 之外对其进行了测试,它运行良好。但是,当我在 Joomla 文章中尝试时,平移不起作用 (http://tylypahka.tk/kartta)。
我将与测试版相同的代码放入 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 还使用 $() 函数名,这可能会导致您的代码停止工作。
-
是的,它正在加载 jQuery。我在我的网站上根本不使用 MooTools,但谢谢 :)
-
你不使用 MooTools 并不意味着它没有被加载,默认情况下它会阻止你使用 jQuery 和
$。检查 firebug 中的错误控制台 -
谢谢,我会尽量避免在不需要时加载 MooTools
标签: javascript image joomla panning