Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaohaoyang committed May 11, 2016
2 parents 65f9382 + cd964e7 commit 4cbb514
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 10 deletions.
5 changes: 5 additions & 0 deletions _includes/backToTop.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="back-to-top">
<a href="#top" class="scroll">
<i class="fa fa-arrow-up" aria-hidden="true"></i>
</a>
</div>
1 change: 0 additions & 1 deletion _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@
</div>
</footer>
<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<script src="{{ " /js/main.js " | prepend: site.baseurl }}" charset="utf-8"></script>
2 changes: 1 addition & 1 deletion _includes/header.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<header>
<header id="top">
<div class="wrapper">
<a href="{{ site.baseurl }}/" class="brand">{{ site.title }}</a>
<small>{{site.brief-intro}}</small>
Expand Down
4 changes: 3 additions & 1 deletion _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
{{ content }}

{% include footer.html %}

{% include backToTop.html %}
<script src="{{ " /js/main.js " | prepend: site.baseurl }}" charset="utf-8"></script>
<script src="{{ " /js/scroll.min.js " | prepend: site.baseurl }}" charset="utf-8"></script>
</body>

</html>
1 change: 0 additions & 1 deletion _layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ <h1>{{page.title}}</h1>
</div>
</div>
</div>
<script src="{{ "/js/scroll.min.js " | prepend: site.baseurl }}" charset="utf-8"></script>
<script src="{{ "/js/pageContent.js " | prepend: site.baseurl }}" charset="utf-8"></script>
3 changes: 1 addition & 2 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,10 @@ <h2 id="comments">Comments</h2>
* target _blank
*/
(function() {
var aTags = document.querySelectorAll('article a')
var aTags = document.querySelectorAll('article a:not([id])')
for (var i = 0; i < aTags.length; i++) {
aTags[i].setAttribute('target', '_blank')
}
}());
</script>
<script src="{{ "/js/scroll.min.js " | prepend: site.baseurl }}" charset="utf-8"></script>
<script src="{{ "/js/pageContent.js " | prepend: site.baseurl }}" charset="utf-8"></script>
46 changes: 46 additions & 0 deletions _sass/_backToTop.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.back-to-top {
position: fixed;
left: 50%;
margin-left: 580px;
bottom: 37px;
background-color: #f8f8fd;
visibility: hidden;
opacity: 0;
transition: 0.4s ease;
box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.3), 0 0 30px rgba(10, 10, 0, 0.1) inset;
a {
display: block;
background-color: #eee;
width: 38px;
height: 38px;
line-height: 38px;
text-align: center;
font-size: 20px;
color: #b4b4b4;
}
}
.back-to-top-show{
visibility: visible;
opacity: 0.7;
}
@media screen and (max-width:1200px) and (min-width: 770px) {
.back-to-top {
left: 50%;
margin-left: 45.5%;
}
}
@media screen and (max-width: 770px) {
.back-to-top {
right:2.5%;
left: auto;
// left: 50%;
margin-left: 0px;
a {
width: 33px;
height: 33px;
line-height: 33px;
text-align: center;
font-size: 18px;
}
}
}
3 changes: 2 additions & 1 deletion css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"index",
"demo",
"footer",
"scrollbar"
"scrollbar",
"backToTop"
;

// 两个人在列车上相遇
Expand Down
25 changes: 25 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,28 @@
})
}
}());


//////////////////////////back to top////////////////////////////
(function() {
var backToTop = document.querySelector('.back-to-top')
var backToTopA = document.querySelector('.back-to-top a')
// console.log(backToTop);
window.addEventListener('scroll',function () {


// 页面顶部滚进去的距离
var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop)

if (scrollTop > 200) {
backToTop.classList.add('back-to-top-show')
} else {
backToTop.classList.remove('back-to-top-show')
}
})

// backToTopA.addEventListener('click',function (e) {
// e.preventDefault()
// window.scrollTo(0,0)
// })
}());
1 change: 0 additions & 1 deletion page/0archives.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,4 @@ <h2 id="y{{ post.date | date: '%Y' }}">{{ post.date | date: '%Y' }}</h2>
</div>
</div>
</div>
<script src="{{ "/js/scroll.min.js " | prepend: site.baseurl }}" charset="utf-8"></script>
<script src="{{ "/js/pageContent.js " | prepend: site.baseurl }}" charset="utf-8"></script>
1 change: 0 additions & 1 deletion page/1category.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,4 @@ <h2 id="{{category | first}}">{{category | first}}</h2>
</div>
</div>
</div>
<script src="{{ "/js/scroll.min.js " | prepend: site.baseurl }}" charset="utf-8"></script>
<script src="{{ "/js/pageContent.js " | prepend: site.baseurl }}" charset="utf-8"></script>
1 change: 0 additions & 1 deletion page/2tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,4 @@ <h2 id="{{ tag }}">{{ tag }}</h2>
</div>
</div>
</div>
<script src="{{ "/js/scroll.min.js " | prepend: site.baseurl }}" charset="utf-8"></script>
<script src="{{ "/js/pageContent.js " | prepend: site.baseurl }}" charset="utf-8"></script>

0 comments on commit 4cbb514

Please sign in to comment.