PersonalWebsite/js/index.js
lukas 8bc9bdfc20 clickable company labels
js reformat
ci rename
2020-04-26 21:05:00 +02:00

35 lines
1.1 KiB
JavaScript

$(function () {
;(function ($, win) {
$.fn.inViewport = function (cb) {
return this.each(function (i, el) {
function visPx() {
const H = $(this).height(),
r = el.getBoundingClientRect(), t = r.top, b = r.bottom;
return cb.call(el, Math.max(0, t > 0 ? H - t : (b < H ? b : H)));
}
visPx();
$(win).on("resize scroll", visPx);
});
};
}(jQuery, window));
$("#section3").inViewport(function (px) {
if (px) {
$("#experienceheader").addClass("animationappear600ms");
const expcontainer = $("#experiencecontentcontainer");
expcontainer.addClass("animationappear300ms");
expcontainer.addClass("experiencecontaineranimation");
}
});
$("#section5").inViewport(function (px) {
if (px) {
$("#contactheader").addClass("animationappear600ms");
$("#contactsubheader").addClass("animationappear300ms");
$(".personalcontacts").addClass("animationappearnow");
}
});
})