【发布时间】:2011-04-26 15:21:05
【问题描述】:
我在美国地图上使用 maphilight 插件,这样当鼠标悬停时,状态会改变颜色。
(http://plugins.jquery.com/project/maphilight
带演示:
http://davidlynch.org/js/maphilight/docs/demo_usa.html)
我的 header.php 中有以下内容(我正在使用 wordpress):
<script language="javascript" type="text/javascript" src="<?php bloginfo('url'); ?>/wp-content/themes/adventure-journal-child/js/jquery-1.2.3.pack.js"></script>
<script language="javascript" type="text/javascript" src="<?php bloginfo('url'); ?>/wp-content/themes/adventure-journal-child/js/jquery.metadata.min.js"></script>
<script language="javascript" type="text/javascript" src="<?php bloginfo('url'); ?>/wp-content/themes/adventure-journal-child/js/jquery.maphilight.js"></script>
在我安装 Styles with Shortcodes (SWS) http://plugins.righthere.com/styles-with-shortcodes/ 之前,它运行良好,以便能够添加也使用 JQuery 的选项卡和工具提示。
两人引发了冲突。因此,一旦删除了与 maphilights 关联的 jQuery 代码,我的选项卡和工具提示就会工作。我一直在阅读这方面的内容,并意识到将代码加载到标题中并不理想。 我的问题是:如何在不引起冲突的情况下让 maphilight 工作?
我试过了:
<script type="text/javascript">
jQuery.noConflict();
jQuery(function() {
jQuery('.map').maphilight({fade: false}); /*set true for fading hover effect*/
});
</script>
maphilight 插件可以使用与我的 Styles with Shortcodes 相同的 jQuery 吗?那么我该怎么做呢?
我想我需要在functions.php 中使用wp_enqueue_script,但我不确定如何去做。
我的最终目标是能够在地图上滚动一个状态,它会突出显示并弹出一个工具提示,其中包含文本和链接。 非常感谢!
【问题讨论】: