I was able to fix this by adding attribute but it should really just default to image type if its not able to auto work this out.
<a href="" data-fancybox-type="image" class="fancybox">
سؤال
We are doing some logic in php to output the image, so the url doesn't have .jpg/etc
This is causing fancybox to exit at the point below where its checking the type. What is the correct way to fix this?
_start: function (index) {
var coming = {},
obj,
href,
type,
margin,
padding;
index = getScalar( index );
obj = F.group[ index ] || null;
if (!obj) {
return false;
}
coming = $.extend(true, {}, F.opts, obj);
// Convert margin and padding properties to array - top, right, bottom, left
margin = coming.margin;
padding = coming.padding;
if ($.type(margin) === 'number') {
coming.margin = [margin, margin, margin, margin];
}
if ($.type(padding) === 'number') {
coming.padding = [padding, padding, padding, padding];
}
// 'modal' propery is just a shortcut
if (coming.modal) {
$.extend(true, coming, {
closeBtn : false,
closeClick : false,
nextClick : false,
arrows : false,
mouseWheel : false,
keys : null,
helpers: {
overlay : {
closeClick : false
}
}
});
}
// 'autoSize' property is a shortcut, too
if (coming.autoSize) {
coming.autoWidth = coming.autoHeight = true;
}
if (coming.width === 'auto') {
coming.autoWidth = true;
}
if (coming.height === 'auto') {
coming.autoHeight = true;
}
/*
* Add reference to the group, so it`s possible to access from callbacks, example:
* afterLoad : function() {
* this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
* }
*/
coming.group = F.group;
coming.index = index;
// Give a chance for callback or helpers to update coming item (type, title, etc)
F.coming = coming;
if (false === F.trigger('beforeLoad')) {
F.coming = null;
return;
}
type = coming.type;
href = coming.href;
if (!type) {
F.coming = null;
//If we can not determine content type then drop silently or display next/prev item if looping through gallery
if (F.current && F.router && F.router !== 'jumpto') {
F.current.index = index;
return F[ F.router ]( F.direction );
}
return false; // this returns false
}
المحلول
I was able to fix this by adding attribute but it should really just default to image type if its not able to auto work this out.
<a href="" data-fancybox-type="image" class="fancybox">