Created
October 1, 2019 23:53
-
-
Save KZeni/e7eee5a81abfe50299a6e31e8ac11032 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fancybox Lightbox | |
$('a[href*="youtu"]').each(function(){ | |
if($(this).attr('href').indexOf('somna') !== -1 || $(this).attr('href').indexOf('band') !== -1 || $(this).attr('href').indexOf('/channel/') !== -1 || $(this).attr('href').indexOf('/user/') !== -1){ | |
// Don't affect links to channel/user pages | |
}else{ | |
$(this).attr('data-fancybox','video-gallery'); | |
} | |
}); | |
$('a[href*="vimeo"]').each(function(){ | |
if($(this).attr('href').indexOf('somna') !== -1 || $(this).attr('href').indexOf('band') !== -1 || $(this).attr('href').indexOf('/channel/') !== -1 || $(this).attr('href').indexOf('/user/') !== -1){ | |
// Don't affect links to channel/user pages | |
}else{ | |
$(this).attr('data-fancybox','video-gallery'); | |
} | |
}); | |
$('a[href*=".jpg"],a[href*=".jpeg"],a[href*=".png"],a[href*=".gif"]').attr('data-fancybox','gallery'); | |
$('.gallery-item a').attr('data-fancybox','gallery'); | |
var imageTitle,imageAlt; | |
$('a[href*=".jpg"],a[href*=".jpeg"],a[href*=".png"],a[href*=".gif"],a[data-fancybox]').each(function(){ | |
imageTitle = ''; | |
imageAlt = ''; | |
imageTitle = $(this).find('img').attr('title'); | |
imageAlt = $(this).find('img').attr('alt'); | |
if($(this).attr('data-caption') === ''){ // Don't replace existing captions | |
if(typeof imageTitle !== 'undefined' && imageTitle !== ''){ | |
$(this).attr('data-caption',imageTitle); | |
}else if(typeof imageAlt !== 'undefined' && imageAlt !== ''){ | |
$(this).attr('data-caption',imageAlt); | |
} | |
} | |
}); | |
$.fancybox.defaults.loop = true; | |
$.fancybox.defaults.smallBtn = true; // Use the small inline close button rather than relying on the toolbar | |
$.fancybox.defaults.animationEffect = 'zoom'; | |
$.fancybox.defaults.transitionEffect = 'tube'; | |
$.fancybox.defaults.buttons = [ | |
'zoom', | |
'share', | |
'slideShow', | |
'fullScreen', | |
'download', | |
'thumbs', | |
'close' | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment