2011-04-26 81 views
0

工作我使用的是美国地图上的maphilight插件,这样当鼠标滚过,状态改变颜色。Maphilight插件没有WordPress的,由于jQuery的冲突

(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> 

这是伟大的工作,直到我安装了简码样式(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插件可以使用相同的jQuery作为我的风格与简码?我如何做到这一点?

我想我需要在functions.php中使用wp_enqueue_script,但我不知道如何去这样做。

我的最终目标是要能够翻身的状态在地图上,它突出和工具提示文本和链接里面弹出。 非常感谢!

回答

0

这是一种很难解决这一个,因为这些支付插件,我们无法看到您的链接的冲突,但有一两件事你可以尝试是更新的jQuery,您目前的1.4.2,但他们是在1.5.2

http://code.jquery.com/jquery-1.5.2.min.js

+0

感谢您的回复。我会尝试。我把行:?? 重新开启,我的高光已开启,现在我的标签已禁用。以下是我正在玩的页面:http://militarywom.com/find-an-installation/ – Laura 2011-04-26 15:57:01

0

你会使用wp_enqueue_script功能,而不是变得更好。我在几个WordPress网站上遇到类似的问题,直到我了解到该功能。