Skip to content

Commit

Permalink
Add load animition for post header & home button.
Browse files Browse the repository at this point in the history
  • Loading branch information
BearD01001 committed Jan 22, 2017
1 parent 15de2e1 commit 4d588f7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
10 changes: 6 additions & 4 deletions layout/_macro/post-header.swig
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
</div>
<h1>{{ page.title }}</h1>
<h2 class="subtitle">{{ page.subtitle || '' }}</h2>
<span class="post-meta-item-text">{{ __('post.posted') }} </span>
<time itemprop="dateCreated" datetime="{{ moment(post.date).format() }}" content="{{ date(post.date, config.date_format) }}" title="{{ moment(post.date).format('YYYY-MM-DD HH:mm:ss') }}">
{{ date(post.date, config.date_format) }}
</time>
<div class="post-time">
<span class="post-meta-item-text">{{ __('post.posted') }} </span>
<time itemprop="dateCreated" datetime="{{ moment(post.date).format() }}" content="{{ date(post.date, config.date_format) }}" title="{{ moment(post.date).format('YYYY-MM-DD HH:mm:ss') }}">
{{ date(post.date, config.date_format) }}
</time>
</div>
</div>
{% endmacro %}
3 changes: 3 additions & 0 deletions source/css/_common/components/header/site-home.styl
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
.site-home {
position: relative;
top: -10px;
display: inline-block;
color: white;
font-size: 18px;
font-weight: bolder;
margin: 5px 20px;
border: none;
opacity: 0;

+tablet() {
font-size: 50px;
Expand Down
3 changes: 3 additions & 0 deletions source/css/_common/components/post/post-header.styl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
}

.post-header {
position: relative;
top: -10px;
width: 960px;
margin: 80px auto 0;
color: white;
opacity: 0;

+mobile() {
width: auto;
Expand Down
13 changes: 11 additions & 2 deletions source/js/src/motion.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ $(document).ready(function () {
var $brand = $('.brand');
var $title = $('.site-title');
var $subtitle = $('.site-subtitle');

var $postheader = $('.post-header');

var $logoLineTop = $('.logo-line-before i');
var $logoLineBottom = $('.logo-line-after i');

Expand All @@ -208,7 +211,7 @@ $(document).ready(function () {
hasElement($title) && sequence.push({
e: $title,
p: {opacity: 1, top: 0},
o: { duration: 200 }
o: {duration: 200}
});

hasElement($subtitle) && sequence.push({
Expand All @@ -217,6 +220,12 @@ $(document).ready(function () {
o: {duration: 200}
});

hasElement($postheader) && sequence.push({
e: $postheader,
p: {opacity: 1, top: 0},
o: {duration: 200}
});

if (sequence.length > 0) {
sequence[sequence.length - 1].o.complete = function () {
integrator.next();
Expand Down Expand Up @@ -255,7 +264,7 @@ $(document).ready(function () {
},

menu: function (integrator) {
$('.menu-item').velocity('transition.slideDownIn', {
$('.menu-item, .site-home').velocity('transition.slideDownIn', {
display: null,
duration: 200,
complete: function () {
Expand Down

0 comments on commit 4d588f7

Please sign in to comment.