解决jqplot与jquery-ui导入必要包时的冲突

本文介绍了解决jqPlot图表库与jQuery UI样式库之间的兼容性问题。通过调整资源文件的加载顺序,实现了同时拥有jQuery UI样式效果及正常显示jqPlot图表的目标。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

对于一个网页中,即要有jqplot的画图,又要有jquery-ui的风格显示!

但在导入必要的包时,出现了问题!

先导入jqplot的必要包:

1 <link type="text/css" rel="stylesheet"  href="../css/jQuery/jqPlot/jquery.jqplot.min.css" />
2 <link type="text/css" rel="stylesheet"    href="../css/jQuery/jqPlot/syntaxhighlighter/styles/shCoreDefault.min.css" />
3 <link type="text/css" rel="stylesheet"    href="../css/jQuery/jqPlot/syntaxhighlighter/styles/shThemejqPlot.min.css" />
4 <script type="text/javascript"  src="../js/excanvas.js"></script>
5 <script type="text/javascript"  src="../js/jQuery/jquery.min.js"></script>
6 <script type="text/javascript"    src="../js/jQuery/jqPlot/staticjquery.jqplot.min.js"></script>
7 <script type="text/javascript"  src="../js/jQuery/jqPlot/syntaxhighlighter/scripts/shCore.min.js"></script>
8 <script type="text/javascript"    src="../js/jQuery/jqPlot/syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
9 <script type="text/javascript"    src="../js/jQuery/jqPlot/syntaxhighlighter/scripts/shBrushXml.min.js"></script>    

再导入jquery-ui的必要包:

1 <link rel="stylesheet" href="../css/bootstrap.min.css" media="screen">
2 <link rel="stylesheet" href="../css/cupertino/jquer121y-ui-1.10.3.custom.css" />
3 <link rel="stylesheet" href="../css/cupertino/button.select.css" />
4 <script src="../jquery_ui/jquery-1.9.1.js"></script>
5 <script src="../js/jquery-ui-1.10.3.custom.js"></script>
6 <script src="../js/jquery.ui.datepicker-zh-TW.js"></script>

这样子的话能有jquery-ui的样式,会画不出图表,想当然就是jquery-ui的必要包会跟jqplot的必要包起冲突,而进行覆盖!

如果导入jquery-ui的必要包,再导入jqplot的必要时的顺序的话,这样不能有jquery-ui的样式,但却能画出图来!

 

解决的方法!如下,将必要包进行混合:

 1 <link type="text/css" rel="stylesheet"  href="../css/jQuery/jqPlot/jquery.jqplot.min.css" />
 2 <link type="text/css" rel="stylesheet"    href="../css/jQuery/jqPlot/syntaxhighlighter/styles/shCoreDefault.min.css" />
 3 <link type="text/css" rel="stylesheet"    href="../css/jQuery/jqPlot/syntaxhighlighter/styles/shThemejqPlot.min.css" />
 4 <link rel="stylesheet" href="../css/bootstrap.min.css" media="screen">
 5 <link rel="stylesheet" href="../css/cupertino/jquer121y-ui-1.10.3.custom.css" />
 6 <link rel="stylesheet" href="../css/cupertino/button.select.css" />  
 7 
 8 <script src="../jquery_ui/jquery-1.9.1.js"></script>
 9 <script src="../js/jquery.ui.datepicker-zh-TW.js"></script>
10 <script type="text/javascript"  src="../js/excanvas.js"></script>
11 <script type="text/javascript"  src="../js/jQuery/jquery.min.js"></script>
12 <script type="text/javascript"    src="../js/jQuery/jqPlot/staticjquery.jqplot.min.js"></script>
13 <script type="text/javascript"  src="../js/jQuery/jqPlot/syntaxhighlighter/scripts/shCore.min.js"></script>
14 <script type="text/javascript"    src="../js/jQuery/jqPlot/syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
15 <script type="text/javascript"    src="../js/jQuery/jqPlot/syntaxhighlighter/scripts/shBrushXml.min.js"></script>    
16 <script src="../js/jquery-ui-1.10.3.custom.js"></script>

 出现上面这样子将必要包导入时不会出现覆盖的情况,即能有jquery-ui的样式,但却能画出图来!

 

转载于:https://www.cnblogs.com/cnJun/p/3299204.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值