文档增加ad信息

This commit is contained in:
click33
2023-07-31 11:01:25 +08:00
parent 17fa35e251
commit 083164617c
2 changed files with 36 additions and 1 deletions

View File

@@ -329,3 +329,13 @@ body {
}
.main-box details p{padding: 0 14px;}
/* 顶部广告 */
#main .top-ad-box{padding: 0.5em 1em; font-size: 12px; margin-bottom: 30px; background-color: rgba(0, 0, 0, 0.04);}
#main .top-ad-box a{border-bottom: 0px;}
#main .top-ad-box a:hover{border-bottom: 0px;}
#main .top-ad-box a img{border: 0px #ddd solid; width: 100%; /* max-height: 80px; */
border-radius: 2px; transition: all 0.2s;}
#main .top-ad-box a img:hover{box-shadow: 0 0 20px #ddd;}
.ad-tips{color: #aaa;}
.ad-close{float: right;}
.ad-close:hover{cursor: pointer; text-decoration: underline; color: red;}

View File

@@ -33,7 +33,7 @@ var myDocsifyPlugin = function(hook, vm) {
return html + footer;
});
// 钩子函数:次路由切换时数据全部加载完成后调用,没有参数。
// 钩子函数:次路由切换时数据全部加载完成后调用,没有参数。
hook.doneEach(function() {
// 功能3给代码盒子添加行数样式
@@ -59,6 +59,31 @@ var myDocsifyPlugin = function(hook, vm) {
if($('.zanzhu-count').length && $('.zanzhu-box table').length) {
$('.zanzhu-count').html($('.zanzhu-box table tr').length);
}
// 功能6标题下面的广告
if(vm.route.path !== '/' && $(window).width() >= 800) {
var ad = `<p class="top-ad-box">
<span class="ad-tips">推广信息:</span>
<span class="ad-tips ad-close">关闭</span>
<a href="http://sa-pro.dev33.cn?from=satop" target="_blank">
<img src="https://oss.dev33.cn/sa-token/ad/sa-sso-pro-x.png" />
</a>
</p>`;
// 没有下划线就先补个下划线
// if($('#main h1').next().prop('tagName') !== 'HR') {
// $('#main h1').after('<hr/>');
// }
// 添加广告
$('#main h1').after(ad);
// 添加关闭事件
$('.top-ad-box .ad-close').click(function(){
console.log(123);
// $('.top-ad-box').slideUp(); // 折叠收起
$(".top-ad-box").fadeOut(1000); // 淡出效果
})
}
});
// 钩子函数:初始化并第一次加载完成数据后调用,没有参数。