若是能力不错能够直接去阅读官方文档资料,再厉害的请去git。javascript
首先去下载须要的资料。css
<!DOCTYPE html> <html lang="zh"> <head> <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> <script type="text/javascript" src="../lib/codemirror.min.js"></script> <link type="text/css" rel="stylesheet" href="../lib/codemirror.css" /> <script type="text/javascript" src="../lib/mergely.js"></script> <link type="text/css" rel="stylesheet" href="../lib/mergely.css" /> <script type="text/javascript"> $(document).ready(function() { $('#compare').mergely({ cmsettings : { readOnly : false, lineNumbers : true }, lhs : function(setValue) { setValue('the quick red fox\njumped over the hairy dog'); }, rhs : function(setValue) { setValue('the quick brown fox\njumped over the lazy dog'); } }); }); </script> </head> <body> <div id="compare"></div> </body> </html>
具体使用介绍请查看官方文档,聪明的你必定会的html