Highcharts不能使用jQuery 1.8,任何解决方法? [英] Highcharts not working with jQuery 1.8, any workaround?

查看:159
本文介绍了Highcharts不能使用jQuery 1.8,任何解决方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个场景,我需要使用jquery 1.8,但是我面临着高图的两个问题,图线不可见,缩放功能也无法正常工作。我已经下载了最新的hightcharts js,即2.3.3版本,有没有解决这个问题的方法?

解决方案

您可以使用 jQuery.noConflict()

要按照特定顺序订购jQuery脚本标签,那么您首先包含的标签将在此后使用 $ 引用,后一个可以使用 jQuery 或者你也可以给出一个你想要的名字,比如 jq172 。由于内部使用 jQuery 的内部高分辨率图表,您希望以后可以使用高图表。

 < script type =text / javascriptsrc =http://code.jquery.com/jquery-1.8.0.js>< / script> 
< script type =text / javascriptsrc =http://code.jquery.com/jquery-1.7.2.js>< / script>
< script type =text / javascript>
window.jq172 = $。noConflict();
< / script>

您现在可以使用 $ 来调节1.8 .0特性和 jQuery jq172 使用1.7.2

  console.log($:+ $()。jquery); 
console.log(jQuery:+ jQuery()。jquery);
console.log(window.jq172:+ jq172()。jquery);

打印到控制台


$:1.8.0

jQuery:1.7.2

window.jq172:1.7.2

jQuery版本冲突| Highchart& Highstock @ jsFiddle

I have a scenario where I need to use jquery 1.8, but I facing facing 2 problems with highcharts, the graph line is not visible and zoom functionality is also not working properly. I have downloaded the latest hightcharts js, ie, version 2.3.3, is there any work around for this?

解决方案

You can use jQuery.noConflict()

You need to order your jQuery script tags in a particular order, the one you include first will henceforth be referred using $ and the latter one can be referred using jQuery or you could also give a name that you want like jq172. Since highcharts internally using jQuery you want to the highchart friendly version later.

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.js" ></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js" ></script>
<script type="text/javascript">
window.jq172=$.noConflict();
</script>

You can now use $ to leverage 1.8.0 features and jQuery or jq172 to use 1.7.2

console.log("$: " + $().jquery);
console.log("jQuery: " + jQuery().jquery);
console.log("window.jq172: " + jq172().jquery);

prints to console

$: 1.8.0
jQuery: 1.7.2
window.jq172: 1.7.2

jQuery version conflict | Highchart & Highstock @ jsFiddle

这篇关于Highcharts不能使用jQuery 1.8,任何解决方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆