朱纯树博客
VPS测评推荐网站
cloudacead cloudacead

WordPress文章代码高亮添加一键复制代码功能

这篇文章本站给大家讲解下怎么给wordpress代码高亮添加一键复制,如果看了上一篇文章的朋友应该已经可以实现文章代码高亮效果,如果还没看那篇文章可以点击下面链接去看一看。

WordPress代码高亮免插件纯代码实现

那么这篇文章就不再讲代码高亮的效果了,直接开始今天的一键复制wordpress教程

实现一键复制主要是需要加载一个JS:clipboard.min.js,然后再自己写一些JS实现点击复制的功能,具体步骤如下:

第一步:加载clipboard文件


//可以自行下载本地上传自己服务器加载

文件加在主题的header.php的上即可。

第二步:实现一键点击复制

首先我们在主题的JS文件中添加下面JS代码:

//复制代码
for (var i = 0; i 复制');
	$('.pre code').eq(i).attr('id','copy'+ i);
}

var clipboard = new ClipboardJS('.copy');
clipboard.on('success', function(e) {
	console.info(e.text);
	e.clearSelection();
	alert('复制成功!')
});

clipboard.on('error', function(e) {
	console.error('Action:', e.action);
	console.error('Trigger:', e.trigger);
	alert("复制失败,请联系站长QQ:1098816988");
});

上面步骤完成后,强制刷新页面即可实现代码一键点击复制的功能,如果有问题可以加入我们的WordPress交流群咨询。

文章来源于互联网:wordpress文章代码高亮添加一键复制代码功能

赞(0) 打赏
未经允许不得转载:VPS测评推荐网站 - 朱纯树博客 » WordPress文章代码高亮添加一键复制代码功能

评论 43

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #45

    Schmidtlein, H stromectol achat

    Voppido2周前 (11-21)回复
  2. #44

    side effects of clomid The Medical Letter will review its role in diabetic neuropathy in a future issue

    refeInnob2周前 (11-18)回复
  3. #43

    Conversely, those with HR negative FBC had in particular an increased risk of HR negative CBC how long to take doxycycline for acne coumadin harga salep erphamazol clotrimazole Chanos, the short seller, returned to Morgan Stanley s prime brokerage business in 2010, the same year Gorman took over as CEO, and has been happy with the relationship since then, a source familiar with the matter said

    Apabili2周前 (11-18)回复
  4. #42

    She met her husband, Graham Swift, as an 18 year old demadex vs lasix DeMarco said

    Inpuncmut3周前 (11-13)回复
  5. #41

    Doxorubicin induced ROS may also contribute to Akt activation, because oxidative stress caused by administration of hydrogen peroxide can activate Akt in fibroblasts and smooth muscle cells 49 52, but activation of Akt in these studies occurred within minutes, was transient, and was observed only in untransformed cells buy priligy generic fraud Kamath PR, et al

    crosile3周前 (11-11)回复
  6. #40

    Intriguingly, our UMAP projection of the lymphatic like cells in cluster 1 delineated two distinct groups, the larger of which contained far fewer cells in Angpt1 О”NC mice suggesting that this group might represent SC endothelial cells clomid vs nolvadex pct

    NofTrurry4周前 (11-09)回复
  7. #39

    The pain does eventually wear off as the day goes on though stromectol over the counter uk

    bloosse4周前 (11-08)回复
  8. #38

    stromectol price PMID 23973528

    roagoff1个月前 (10-27)回复
  9. #37

    Pathobiology of Kindler syndrome is not well understood buy cialis generic

    EfFimiTom2个月前 (10-14)回复
  10. #36

    We eliminated strategies exhibiting extended dominance from the rank ordered list, and we recalculated ICERs of the remaining strategies lasix dosage for dogs Angelo hELGeEfKgycutdvt 5 20 2022

    envelland2个月前 (10-08)回复
  11. #35

    Different salts Na, K, procaine, benzathine were also created for pharmacokinetic purposes. buy doxycycline dose for std However, to the best of our knowledge, this is by far the only meta- analysis to exclusively assess the correlation between VitC intake and BC occurrence and mortality.

    immosautt3个月前 (09-17)回复
  12. #34

    Mohammed sCOeGnSzUVmoWTF 5 29 2022. tamoxifen uses

    Moxjounny3个月前 (09-14)回复
  13. #33

    McConnell s care and always felt that I could go to her with questions. where can i buy clomid from india Each patient presents the clinician with something well known and well recognized, as well as something new or unusual, which stimulates further research.

    meeniaTex3个月前 (09-11)回复