single lightbox
This commit is contained in:
6
js/lib/jquery.colorbox-min.js
vendored
Normal file
6
js/lib/jquery.colorbox-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -59,33 +59,34 @@
|
||||
}
|
||||
})()
|
||||
|
||||
//isHome
|
||||
const isHome = (_ => {
|
||||
if ($('body').hasClass("home")) {
|
||||
return true
|
||||
// checks if body has a class
|
||||
function bodyHasClass(classname, notclassname){
|
||||
if ($('body').hasClass(classname)) {
|
||||
if (notclassname) {
|
||||
if ($('body').hasClass(notclassname)) {
|
||||
return false
|
||||
}else{
|
||||
return true
|
||||
}
|
||||
} else{
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})()
|
||||
}
|
||||
|
||||
//isHome
|
||||
const isHome = bodyHasClass('home')
|
||||
|
||||
//isArchive
|
||||
const isArchive = (_ => {
|
||||
if ($('body').hasClass("archive") & !$('body').hasClass("category-esemeny")) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})()
|
||||
const isArchive = bodyHasClass('archive','category-esemeny')
|
||||
|
||||
//isEsemeny
|
||||
const isEsemeny = (_ => {
|
||||
if ($('body').hasClass("category-esemeny")) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})()
|
||||
const isEsemeny = bodyHasClass('category-esemeny')
|
||||
|
||||
//isSingle
|
||||
const isSingle = bodyHasClass('single')
|
||||
|
||||
|
||||
|
||||
@@ -689,6 +690,50 @@
|
||||
})
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* SINGLE */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
if (isSingle) {
|
||||
|
||||
/* -------------------------------- Lightbox -------------------------------- */
|
||||
|
||||
|
||||
|
||||
//group gallery images:
|
||||
$('.wp-block-gallery a, .wp-block-image a').addClass('cb-gallery')
|
||||
|
||||
//copy figcaption to title
|
||||
$("a.cb-gallery ~ figcaption").each(function(){
|
||||
let captiotext = $(this).html()
|
||||
$(this).prev('.cb-gallery').attr({title:captiotext})
|
||||
})
|
||||
|
||||
//http://www.jacklmoore.com/colorbox/
|
||||
const colorboxSettings = {
|
||||
transition:'fade',
|
||||
rel:'cb-ballery',
|
||||
maxWidth: '90%',
|
||||
maxHeight: '80%',
|
||||
trapFocus: false,
|
||||
scrolling: false,
|
||||
fixed: true,
|
||||
previous: '',
|
||||
next:'',
|
||||
close:'',
|
||||
|
||||
}
|
||||
|
||||
// lightbox for galleries
|
||||
$(".wp-block-gallery a").colorbox(colorboxSettings)
|
||||
|
||||
//single images
|
||||
$(".wp-block-image a").colorbox(colorboxSettings)
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------- END OF FILE ------------------------------ */
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user