works on single

This commit is contained in:
2019-07-11 13:36:28 +02:00
parent 99e2082e42
commit 4c443cd7ec
6 changed files with 731 additions and 220 deletions

View File

@@ -733,7 +733,13 @@
//hide caption on desktop
if (!isMobile) {
$('.wp-block-gallery, .wp-block-image').children('figcaption').hide()
$('.wp-block-gallery img, .wp-block-image img').hover(function () {
$(this).parent('a').next("figcaption").addClass("vis")
}, function () {
$('.wp-block-gallery .vis, .wp-block-image .vis')
.removeClass("vis")
})
}
@@ -770,7 +776,48 @@
//single images
$(".wp-block-image a").colorbox(colorboxSettings)
}
/* ---------------------------- hover and click on related ---------------------------- */
$(document).on({
mouseenter: function () {
if (!Modernizr.touchevents) {
showTitle(this)
}
},
mouseleave: function () {
if (!Modernizr.touchevents) {
hideTitle(this)
}
}
}, '#related_posts li');
//touch on small articles
$(document).on({
'touchend': function (e) {
e.preventDefault()
var art = $(this).parents("li")
var metadata = art.children(".metadata")
if (metadata.hasClass("vis")) {
hideTitle(art)
} else {
hideTitle($(".vis").parents("li"))
showTitle(art)
}
}
}, "#related_posts li a.related_thumbnailwrapper")
//click on related
$('#related_posts li').click(function () {
let href = $(this).children('a.related_thumbnailwrapper').attr("href")
window.open(href, "_self")
})
}//if single end
/* ------------------------------- END OF FILE ------------------------------ */