[记录]为文章标题链接添加“少女祈祷中…”提示 | 祭夜博客
  • 欢迎光临,这个博客颜色有点多

[记录]为文章标题链接添加“少女祈祷中…”提示

记录 msojocs 4年前 (2020-06-20) 1659次浏览 已收录 0个评论 扫描二维码
/*取得带有链接的h2标题、日志标题,存放在titles数组中*/
var titles = document.querySelectorAll("h2 a, .post-title a");
/*遍历数组*/
for (var i=0;i<titles.length;i++) {
    /*添加鼠标点击事件*/
    titles[i].onclick = function() {
        /*改变标题文本*/
        var title = this.lastChild.nodeValue;
        var retitle = this;
        this.lastChild.nodeValue = "少女祈祷中...";
        /*2秒后恢复标题文本(如果2秒后链接还没跳转的话)*/
        setTimeout(function(){retitle.lastChild.nodeValue = title;},2000);
    }
}

祭夜の咖啡馆 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:[记录]为文章标题链接添加“少女祈祷中…”提示
喜欢 (1)
[1690127128@qq.com]
分享 (0)
发表我的评论
取消评论
OwO表情
贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址