https://highlightjs.org/ https://www.cnblogs.com/dealblog/p/6822563.html <!DOCTYPE html> <html lang="zh-cmn-Hans"> <head> <meta charset="UTF-8"> <title>highlightjs</title> <!-- https://highlightjs.org/static/demo/ --> <link rel="stylesheet" href="http://static.xcabc.com/highlight/styles/atom-one-dark.css"> </head> <body> <pre> <code class="javascript"> renderPageNav: function(num, curpage){ console.log(curpage); var that = this; console.log(num); //共有多少条这个没有出现注释 // $('.result span').html('共有'+num+'条'); // $('.result').removeClass('hide'); //没有条数不展示分页导航 if(num==0){ // console.log('hide navigation') // 为什么会进入这里啊 alert("我进分页下面的啦"); that.maxpage = 0; return $('.navigation').addClass('hide'); } curpage = parseInt(curpage); var html = ''; // 最大页数取整 var maxpage = Math.ceil(num/that.pagesize); </code> <pre> </body> <script type="text/javascript" src="http://static.xcabc.com/highlight/highlight.pack.js"></script> <script>hljs.initHighlightingOnLoad();</script> </html> 提示:你可以先修改部分代码再运行。 转载请注明:有爱前端 » 代码高亮插件highlight 喜欢 (0)or分享 (0)