-
Notifications
You must be signed in to change notification settings - Fork 0
/
cover.js
23 lines (21 loc) · 807 Bytes
/
cover.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(function($){
// move cover
var ele_cover = $("#cover");
ele_cover.appendTo($("#header"));
// set height of the cover
var ele_profile = $("#profile");
var h_win = $(window).height(), h_nav = $("#main-nav").height(), h_cover = h_win - h_nav,
h_profile = ele_profile.height(), padTop_profile = (h_win - h_profile) * 0.4;
ele_cover.height(h_cover);
// set margin-top of profile
ele_profile.css("padding-top", padTop_profile);
// anystretch
var cover_url = ele_profile.attr("alt");
if (cover_url.length)
ele_cover.anystretch(cover_url);
$(window).on('resize', function() {
h_win = $(window).height(), h_cover = h_win - h_nav, padTop_profile = (h_win - h_profile) * 0.4;
ele_cover.height(h_cover);
ele_profile.css("padding-top", padTop_profile);
});
})(jQuery);