-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascripts.html
More file actions
41 lines (34 loc) · 1.44 KB
/
Copy pathjavascripts.html
File metadata and controls
41 lines (34 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="{{ "/assets/js/jquery.fitvids.js" | prepend: site.baseurl }}"></script>
<script type="text/javascript" src="{{ "/assets/js/index.js" | prepend: site.baseurl }}"></script>
<script type="text/javascript" src="{{ "/assets/js/readingTime.min.js" | prepend: site.baseurl }}"></script>
<script>
(function ($) {
"use strict";
$(document).ready(function(){
var $window = $(window),
$image = $('.post-image-image, .teaserimage-image');
$window.on('scroll', function() {
var top = $window.scrollTop();
if (top < 0 || top > 1500) { return; }
$image
.css('transform', 'translate3d(0px, '+top/3+'px, 0px)')
.css('opacity', 1-Math.max(top/700, 0));
});
$window.trigger('scroll');
var height = $('.article-image').height();
$('.post-content').css('padding-top', height + 'px');
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&& location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({ scrollTop: target.offset().top }, 500);
return false;
}
}
});
});
}(jQuery));
</script>