我有一个场景,我需要使用jquery 1.8,但是我面临着高图的两个问题,图线不可见,缩放功能也无法正常工作。我已经下载了最新的hightcharts js,即2.3.3版本,有没有解决这个问题的方法?
解决方案您可以使用 jQuery.noConflict()
要按照特定顺序订购jQuery脚本标签,那么您首先包含的标签将在此后使用 $ 引用,后一个可以使用 jQuery 或者你也可以给出一个你想要的名字,比如 jq172 。由于内部使用 jQuery 的内部高分辨率图表,您希望以后可以使用高图表。 < script type =text / javascriptsrc =code.jquery/jquery-1.8.0.js>< / script> < script type =text / javascriptsrc =code.jquery/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="code.jquery/jquery-1.8.0.js" ></script> <script type="text/javascript" src="code.jquery/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,任何解决方法?
发布评论