效果美化及若干效果bug修复

This commit is contained in:
结发受长生 2019-08-25 14:22:31 +08:00
parent 66a69b1100
commit eb5625c3ae
11 changed files with 43 additions and 67 deletions

View File

@ -1,5 +1,4 @@
<% var defaultBg = '#4d4d4d'; %>
<div class="overlay" ></div>
<div class="intrude-less">
<header id="header" class="inner">
<a href="<%=config.root%>" @mouseover="linkMouseover('home')" class="profilepic">

View File

@ -1,3 +1,4 @@
<div class="article-outer">
<article class="article">
<h3 class="category-count">共计 <%= site.categories.length %> 个分类, <%= site.tags.length %> 个标签</h3>
<% if (site.categories.length){ %>
@ -21,4 +22,5 @@
amount: 999
}) %>
</div>
</article>
</article>
</div>

View File

@ -27,10 +27,13 @@ html, body, #container {
.anm-canvas {
display: none;
}
&.show .anm-canvas {
display: block;
position: fixed;
}
&.show {
overflow-y: hidden;
.anm-canvas {
display: block;
position: fixed;
}
}
}
.body-wrap{
padding-top: 30px;

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -1,21 +1,13 @@
.left-col {
background: $colorBg;
background: $colorBg url(./img/left_bg.jpg) no-repeat;
background-size: cover;
width: 300px;
position:fixed;
opacity:1;
@extend %trans;
height:100%;
z-index: 999;
&.show {
@extend %shadow;
}
.overlay{
width: 100%;
height: 130px;
position: absolute;
background: #4d4d4d;
@extend %trans;
}
z-index: 999;
@extend %shadow;
.intrude-less {
width: 76%;

View File

@ -105,9 +105,6 @@ body.night {
display: none;
}
}
.overlay {
background: none;
}
// 头像 看板娘 图标 -> 降低亮度滤镜
.profilepic, .waifu, #header .header-nav .social a {
filter: brightness(30%);

View File

@ -1,13 +1,12 @@
var backTop = function (domE, ctn, distance) {
if (!domE) return
var timer = null
var _onscroll = ctn.onscroll
ctn.onscroll = throttle(function () { // 滚动到一定高度才显示"回到顶部"按钮
typeof _onscroll === 'function' && _onscroll.apply(this, arguments)
toggleDomE()
}, 100)
ctn.addEventListener('scroll', function(){
// 滚动到一定高度才显示"回到顶部"按钮
throttle(toggleDomE, 200)(domE, ctn, distance)
})
if(!window.getComputedStyle || window.getComputedStyle(ctn).scrollBehavior === undefined) {
// 浏览器不支持scroll-behavior属性
let timer = null
domE.querySelector('a[href="#top"]').addEventListener('click', function (event) {
event.preventDefault()
timer = setInterval(function () { //设置一个计时器
@ -26,16 +25,15 @@ var backTop = function (domE, ctn, distance) {
})
}
function toggleDomE() {
domE.style.display = (ctn.scrollTop || document.documentElement.scrollTop || document.body.scrollTop) > distance ? 'block' : 'none'
function toggleDomE(targetDom, containerDom, distance) {
targetDom.style.display = (containerDom.scrollTop || document.documentElement.scrollTop || document.body.scrollTop) > distance ? 'block' : 'none'
}
function throttle(func, wait) {
var timer = null
return function () {
var self = this, args = arguments
return function (...args) {
if (timer) clearTimeout(timer)
timer = setTimeout(function () {
return typeof func === 'function' && func.apply(self, args)
timer = setTimeout(() => {
return typeof func === 'function' && func.apply(this, args)
}, wait)
}
}

View File

@ -27,17 +27,17 @@ Util.addLoadEvent(function() {
},{ // 放大
scale: 0.8
},{ // 缩小
scale: 1.2
scale: 1.1
},{ // 绕X轴旋转
rotate: { x: 30 }
},{ // 绕Y轴旋转
rotate: { y: 30 }
rotate: { y: 20 }
}]
import(/* webpackChunkName: "scrollreveal" */ 'scrollreveal').then(ScrollReveal => {
let index = Math.floor(Math.random() * animateTypes.length)
ScrollReveal.default().reveal('.article-index', Object.assign({
delay: 200,
container: document.querySelector('#container')
container: document.getElementById('container')
}, animateTypes[index]))
})
}

View File

@ -92,11 +92,8 @@ function checkScrollSlide(){
}
function init() {
var _onscroll = scrollDom.onscroll
var timer = null
scrollDom.onscroll = function () {
// 保留已有的滚动事件回调函数并在新的回调函数中进行调用
typeof _onscroll === 'function' && _onscroll.apply(this, arguments)
scrollDom.addEventListener('scroll', function(){
if(scrollLock) return
if(timer) clearTimeout(timer)
timer = setTimeout(()=>{
@ -105,7 +102,7 @@ function init() {
}
timer = null
}, 200)
}
})
loadMoreItems(defaultStep)
}
export default { init }

View File

@ -8,22 +8,23 @@ const Util = (function(){
var t = /&quot;|&lt;|&gt;|&amp;|&nbsp;|&apos;|&#(\d+);|&#(\d+)/g
, o = /['<> "&]/g
, u = {
"&quot;": '"',
"&lt;": "<",
"&gt;": ">",
"&amp;": "&",
"&nbsp;": " "
}
"&quot;": '"',
"&lt;": "<",
"&gt;": ">",
"&amp;": "&",
"&nbsp;": " "
}
, c = /\u00a0/g
, a = /<br\s*\/?>/gi
, i = /\r?\n/g
, f = /\s/g
, p = {}
for (var s in u)
p[u[s]] = s;
return u["&apos;"] = "'",
p["'"] = "&#39;",
{
for (let s in u) {
p[u[s]] = s
}
u["&apos;"] = "'"
p["'"] = "&#39;"
return {
encode: function(e) {
return e ? ("" + e).replace(o, n).replace(i, "<br/>").replace(f, "&nbsp;") : ""
},
@ -67,21 +68,9 @@ const Util = (function(){
return e.encode(r)
return r
},
loadScript: function(path) {
var $script = document.createElement('script')
document.getElementsByTagName('body')[0].appendChild($script)
$script.setAttribute('src', path)
},
addLoadEvent: function(func){
var oldonload = window.onload
if (typeof window.onload !== "function") {
window.onload = func
} else {
window.onload = function() {
oldonload()
func()
}
}
if(typeof func !== 'function') return
document.addEventListener("DOMContentLoaded", func)
}
}
})()

View File

@ -43,7 +43,6 @@ function init() {
})
}
// export default { init }
if(!window.themeConfig.pageid) { // 非个性化页面的普通文章
Util.addLoadEvent(init)
}