template: Avoid JavaScript error for documents with no srcset attribute.

This commit is contained in:
Bradley Sepos 2018-02-17 04:59:17 -05:00
parent 4dacd67676
commit 27da5acfc3
No known key found for this signature in database
GPG Key ID: DEADE2F57D42D9C7

View File

@ -189,7 +189,7 @@ $(document).ready(function(){
$.featherlight.defaults.contentFilters.unshift('image2');
docs.find('figure > a:has(img)').each(function(){
var srcset = $(this).children('img').first().attr('srcset');
if (srcset.length > 0){
if (typeof srcset !== 'undefined'){
$(this).attr('data-srcset', srcset);
}
$(this).featherlight({type: 'image2', openSpeed: 150, closeSpeed: 150});