working on startpage and single

This commit is contained in:
2019-07-10 18:24:34 +02:00
parent 67661ed767
commit d1dbc518e3
11 changed files with 182 additions and 121 deletions

View File

@@ -43,7 +43,7 @@
vh: vh,
bottomScrollHeight: bottomScrollHeight
}
console.log(cssWidths)
// console.log(cssWidths)
/* --------------------------- css values to vars --------------------------- */
@@ -51,7 +51,7 @@
const isMobile = (_ => {
if (wow < 769) {
//mobile settings
$('.social-link').addClass('hidden')
$('.social-link, .events-link').addClass('hidden')
return true
} else {
@@ -59,7 +59,12 @@
}
})()
// checks if body has a class
/**
* Checks if body has a class
* @param {string} classname The class to check
* @param {string} notclassname Optional: this classname makes it false
* @returns {boolean} True if body has that class, false if not OR it contains the notclassname
*/
function bodyHasClass(classname, notclassname) {
if ($('body').hasClass(classname)) {
if (notclassname) {
@@ -105,9 +110,9 @@
var showHideSocial = function () {
if (isMobile && $('.social-link').hasClass('hidden')) {
$('.social-link').removeClass('hidden')
$('.social-link, .events-link').removeClass('hidden')
} else if (isMobile) {
$('.social-link').addClass('hidden')
$('.social-link, .events-link').addClass('hidden')
}
}
@@ -318,13 +323,13 @@
/* ----------------------------- Snap on mobile ----------------------------- */
if (isMobile) {
if (isHome || isArchive) {
$("article.post").SnapScroll({
animateDuration: 400
});
}
}
// if (isMobile) {
// if (isHome || isArchive) {
// $("article.post").SnapScroll({
// animateDuration: 400
// });
// }
// }
/* --------------------------------- To top --------------------------------- */
@@ -435,18 +440,21 @@
currElem = homeScroll(currElem, "next")
})
/* --------------------------- scroll on keyboard --------------------------- */
$('html').keydown(function () {
/* --------------------------- scroll with keyboard --------------------------- */
$('html *:not(input)').keydown(function () {
if (!isMobile) {
if (isHome || isArchive) {
//right:
if (event.which == 39) {
event.preventDefault();
currElem = homeScroll(currElem, "next")
// left:
} else if (event.which == 37){
currElem = homeScroll(currElem, "prev")
if (!$('.search-bar *').is(':focus')) {
//right and J
if (event.which == 39 || event.which == 74) {
event.preventDefault();
currElem = homeScroll(currElem, "next")
// left and K:
} else if (event.which == 37 || event.which == 75) {
currElem = homeScroll(currElem, "prev")
}
}
}
}
})
@@ -528,6 +536,13 @@
});
}
/* ------------------------- Click on small articles ------------------------ */
$('article.home-small').click(function () {
let href = $(this).children('a.thumbnailwrapper').attr("href")
window.open(href, "_self")
})
/* ------------------------------ hover on home ----------------------------- */
//hover on big articles