2019 08 28 word mods

This commit is contained in:
infeeeee
2019-09-03 00:08:51 +02:00
parent 74a33168d7
commit cd3124784f
18 changed files with 681 additions and 401 deletions

View File

@@ -12,39 +12,46 @@
/* -------------------------------- geometry -------------------------------- */
const vw = $(window).width()
// const vw = $(window).width()
const wow = window.outerWidth
const wiw = window.innerWidth
const bw = $('body').width()
// const bw = $('body').width()
const wih = window.innerHeight
const vh = $(window).height()
// const woh = window.outerHeight
// const wih = window.innerHeight
// const vh = $(window).height()
// const boh = document.body.offsetHeight
// const dch = document.documentElement.clientHeight
const desktophomemargin = $(".header-1")[0].getBoundingClientRect().width
const bottomScrollHeight = 0
// height of scrollbar at bottom
const bottomScrollHeight = (_ => {
if (wih / vh > 1.5) {
return 0
} else {
let bs = wih - vh
return bs
}
})()
// const bottomScrollHeight = (_ => {
// if (wih / vh > 1.5) {
// return 0
// } else {
// let bs = wih - vh
// // let bs = wiw - vw
// return bs
// }
// })()
const cssWidths = {
vw: vw,
wow: wow,
wiw: wiw,
bw: bw,
desktophomemargin: desktophomemargin,
wih: wih,
vh: vh,
bottomScrollHeight: bottomScrollHeight
}
console.log(cssWidths)
// const cssWidths = {
// w_vw: vw,
// w_wow: wow,
// w_wiw: wiw,
// w_bw: bw,
// desktophomemargin: desktophomemargin,
// h_wih: wih,
// h_vh: vh,
// bottomScrollHeight: bottomScrollHeight,
// h_woh: woh,
// h_boh: boh,
// h_dch: dch
// }
// console.log(cssWidths)
/* --------------------------- css values to vars --------------------------- */
@@ -302,6 +309,14 @@
}//isMasonryPage end
}// !isMobile end
/* ---------------- move bevezeto out from metadata on mobile --------------- */
if (isHome && isMobile) {
$("article .metadata .bevezetoWrapper").each(function () {
$(this).parents('article').append($(this))
})
}
/* ----------------------------- random cutouts ----------------------------- */
function random2() {
@@ -341,16 +356,16 @@
//add class to odd elems
function mobileHomeClass() {
if (isMobile && isMasonryPage) {
$('article:not(.post_nr):not(.cutOk) ').addClass('cutCurr')
$('article.cutCurr:nth-child(even)').addClass('cut-even')
$('article.cutCurr').addClass('cutOk').removeClass('cutCurr')
}
// function mobileHomeClass() {
// if (isMobile && isMasonryPage) {
// $('article:not(.post_nr):not(.cutOk) ').addClass('cutCurr')
// $('article.cutCurr:nth-child(even)').addClass('cut-even')
// $('article.cutCurr').addClass('cutOk').removeClass('cutCurr')
// }
}
// }
mobileHomeClass()
// mobileHomeClass()
/* ----------------------------- Snap on mobile ----------------------------- */
@@ -364,15 +379,15 @@
/* --------------------------------- To top --------------------------------- */
$(".totop>a").click(function (e) {
e.preventDefault()
$('html, body').stop().animate({ scrollTop: 0 }, 800);
})
// $(".totop>a").click(function (e) {
// e.preventDefault()
// $('html, body').stop().animate({ scrollTop: 0 }, 800);
// })
//hide totop if not needed
if (!($("main").height() > $(window).height()) && isMobile) {
$(".totop").hide()
}
// //hide totop if not needed
// if (!($("main").height() > $(window).height()) && isMobile) {
// $(".totop").hide()
// }
/* ---------------------------- Scroll on desktop --------------------------- */
@@ -801,11 +816,11 @@
})
}
if (!isMobile && isHome) {
setTimeout(() => {
bigArticleHoverShow($(".home_wrapper-1 .home-big h2 a"))
}, 2000);
}
// if (!isMobile && isHome) {
// setTimeout(() => {
// bigArticleHoverShow($(".home_wrapper-1 .home-big h2 a"))
// }, 2000);
// }
@@ -992,12 +1007,14 @@
$(this).prev('.cb-gallery').attr({ title: captiotext })
})
const lightBoxMaxHeight = isMobile ? '65%' : '80%'
//http://www.jacklmoore.com/colorbox/
const colorboxSettings = {
transition: 'none',
rel: 'cb-ballery',
maxWidth: '90%',
maxHeight: '80%',
maxHeight: lightBoxMaxHeight,
trapFocus: false,
scrolling: false,
fixed: true,
@@ -1009,6 +1026,17 @@
}
//swipe on mobile on lightbox
$('#cboxOverlay, #colorbox').swipe({
swipeLeft: function () {
$.colorbox.next()
},
swipeRight: function () {
$.colorbox.prev()
},
})
// lightbox for galleries
$(".wp-block-gallery a").colorbox(colorboxSettings)