fixed hover on big articles on resize

This commit is contained in:
infeeeee
2019-09-07 00:09:19 +02:00
parent 58be407f0a
commit 9393e8be06

View File

@@ -204,11 +204,11 @@
} }
//wrap classes //wrap classes
for (let i = 0; i < articleWrapCounter; i++) { for (let i = 0; i < articleWrapCounter; i++) {
var j = i + 1 let j = i + 1
if (isHome) { if (isHome) {
j = i + 3 j = i + 3
} }
var k = i + 1 let k = i + 1
$(".home-thumbnail-small-" + k).wrapAll('<div class="home_wrapper-small home_wrapper-' + j + '"></div>') $(".home-thumbnail-small-" + k).wrapAll('<div class="home_wrapper-small home_wrapper-' + j + '"></div>')
if (i == 0) { if (i == 0) {
$(".home_wrapper-" + j).addClass("home_wrapper-s1") $(".home_wrapper-" + j).addClass("home_wrapper-s1")
@@ -241,7 +241,7 @@
function moveBevezetoDesktop() { function moveBevezetoDesktop() {
$("article>.bevezetoWrapper").each(function () { $("article>.bevezetoWrapper").each(function () {
$(this).parent('article').children('.metadata').append($(this)) $(this).parent('article').children('.metadata').children('.postedon').after($(this))
}) })
} }
@@ -821,12 +821,16 @@
//hover on big articles //hover on big articles
$(".home-big h2 a").hover(function () { $('body').on('mouseenter', '.home-big h2 a', function () {
bigArticleHoverShow($(this)) bigArticleHoverShow($(this))
})
$('body').on('mouseleave', '.home-big h2 a', function () {
bigArticleHoverHide($(this))
})
}, function () { function bigArticleHoverHide(cc) {
// let cc = $(this)
let cc = $(this) if (!isMobile) {
let cArticle = cc.parents("article") let cArticle = cc.parents("article")
let cMetadata = cArticle.children(".metadata") let cMetadata = cArticle.children(".metadata")
@@ -846,11 +850,13 @@
//hide and show metadata //hide and show metadata
cMetadata.children(".alcimWrapper, .bevezetoWrapper").css({ display: 'none' }).removeClass("transparent") cMetadata.children(".alcimWrapper, .bevezetoWrapper").css({ display: 'none' }).removeClass("transparent")
cMetadata.children(".categories, .postedon").removeClass("transparent").show() cMetadata.children(".categories, .postedon").removeClass("transparent").show()
cMetadata.css({ height: '' })
}) })
}) }
}
function bigArticleHoverShow(cc) { function bigArticleHoverShow(cc) {
if (!isMobile) {
// let cc = $(this) // let cc = $(this)
let cArticle = cc.parents("article") let cArticle = cc.parents("article")
let cMetadata = cArticle.children(".metadata") let cMetadata = cArticle.children(".metadata")
@@ -926,6 +932,7 @@
ellipsis.set(); ellipsis.set();
}) })
} }
}
// Uncomment for debugging hover // Uncomment for debugging hover
// if (!isMobile && isHome) { // if (!isMobile && isHome) {
@@ -938,14 +945,14 @@
/* ------------------------- hover on small articles ------------------------ */ /* ------------------------- hover on small articles ------------------------ */
function showTitle(th) { function showTitle(th) {
if (!$('body').hasClass('no-result')) { if (!$('body').hasClass('no-result') && !isMobile) {
$(th).children("h2").show() $(th).children("h2").show()
$(th).children(".metadata").addClass("vis") $(th).children(".metadata").addClass("vis")
} }
} }
function hideTitle(th) { function hideTitle(th) {
if (!$('body').hasClass('no-result')) { if (!$('body').hasClass('no-result') && !isMobile) {
$(th).children("h2").hide() $(th).children("h2").hide()
$(th).children(".metadata").removeClass("vis") $(th).children(".metadata").removeClass("vis")
} }
@@ -1159,6 +1166,8 @@
// calc other vars // calc other vars
menuWidth = mwCalc() menuWidth = mwCalc()
articleWrapCounter = 0
//run load script //run load script
loadPage() loadPage()