promo pages

This commit is contained in:
Jerryby
2019-02-14 14:06:28 +03:00
parent 6f49c63bb6
commit 964e607936
56 changed files with 662 additions and 1977 deletions

View File

@@ -0,0 +1,53 @@
document.addEventListener("DOMContentLoaded", function(event) {
var elemToScroll;
function scrollToHash(){
var feHeight = $(elemToScroll).offset().top;
if ($('header').length && $('header').is(":visible")) {
feHeight = feHeight - $('header').outerHeight();
}
$('html, body').scrollTop(feHeight);
}
function closestByClass(el, clazz) {
while (el.className !== clazz) {
el = el.parentNode;
if (!el) {
return null;
}
}
return el;
}
if (location.hash) {
setTimeout(function() {
window.scrollTo(0, 0);
elemToScroll = location.hash;
scrollToHash();
}, 1);
}
var links = document.querySelectorAll('.feature-links.inner .feature-link');
if (links.length > 0){
for (var i = 0; i< links.length; i++){
links[i].addEventListener('click', function(e){
e.preventDefault();
var el = closestByClass(e.target, 'feature-link');
elemToScroll = el.hash;
scrollToHash();
}, false);
}
}
//we don't actually need this
$('body').on('click', '.article-index li a', function(e){
e.preventDefault();
elemToScroll = e.target.hash;
scrollToHash();
});
});