WordPress B2主题美化一键复制+代码高亮

释放双眼,带上耳机,听听看~!

代码一键复制功能代码-child.js文件

//文章页面高亮代码复制粘贴
for (var i = 0; i < $(".prettyprint").length; i++) {
    $(".prettyprint").eq(i).append('一键复制');
    $(".prettyprint").eq(i).attr('id','copy'+ i);
}
var clipboard = new ClipboardJS('.copy');
clipboard.on('success', function(e) {
    //console.info(e.text); 提示
    e.clearSelection();
    e.trigger.innerHTML = "一键复制成功";
     e.trigger.disabled = true;
        setTimeout(function() {
            e.trigger.innerHTML = "一键复制";
            e.trigger.disabled = false;
        },
        2000);
/**时长**/
});
//文章页面高亮代码复制粘贴

2.一键复制美化代码至style.css文件

/**代码高亮**/
.entry-content pre:before {
content: '';
position: absolute;
top: 0;
left: 25px;
width: 15px;
height: 15px;
border-radius: 50%;
margin: 15px 25px;
background: #fdbc40;
}
ol.linenums:after {
content: '';
position: absolute;
top: 0;
left: 50px;
width: 15px;
height: 15px;
border-radius: 50%;
margin: 15px 25px;
background: #35cd4b;
}.entry-content pre:after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 15px;
height: 15px;
border-radius: 50%;
background: #fc625d;
margin: 15px 25px;
}.entry-content pre {
position: relative;
border-radius: 6px;
/**background: #21252b;**/
padding-top: 50px;
box-shadow: 0px 8px 20px -10px #000;
}.entry-content pre .copy {
position: absolute;
top: 0;
right: 0;
margin: 10px 20px;
cursor: pointer;
color: #8224e3;
}
/**代码高亮**/
文章链接:https://wuzuhua.cn/550.html
文章标题:WordPress B2主题美化一键复制+代码高亮
文章版权:空木白博客 (https://wuzuhua.cn) 所发布的内容,部分为原创文章,转载请注明来源,网络转载文章如有侵权请联系我们!
本文最后更新发布于2023年09月12日 14时50分39秒,某些文章具有时效性,若有错误或已失效,请在下方留言或联系空木白:18177233@qq.com

给TA打赏
共{{data.count}}人
人已打赏
WordPress

WordPress文章可视化短代码简码

2023-9-12 11:49:00

WordPress

WordPress携手Jetpack免费提供永久缓存图片CDN加速

2023-10-14 10:50:12

0 条回复 A文章作者 M管理员
每日一言:所谓婚姻,就是两个家庭的,资产重组。
    暂无讨论,说说你的看法吧
日夜切换
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索
我是底线可爱胖!冲鸭~