Javascript 从php生成的fancybox 2开放图像

Javascript 从php生成的fancybox 2开放图像,javascript,jquery,fancybox-2,Javascript,Jquery,Fancybox 2,我们在php中执行一些逻辑来输出图像,因此url没有.jpg/etc 这将导致fancybox在其检查类型的位置下方退出。解决这个问题的正确方法是什么 _start: function (index) { var coming = {}, obj, href, type, margin, padding;

我们在php中执行一些逻辑来输出图像,因此url没有.jpg/etc

这将导致fancybox在其检查类型的位置下方退出。解决这个问题的正确方法是什么

_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
            }

我可以通过添加属性来解决这个问题,但如果它不能自动解决这个问题,它实际上应该默认为图像类型

<a href="" data-fancybox-type="image" class="fancybox">

这就是FAQ被发明的原因。==>常见问题选项卡==>否。5@JFK我不认为当我没有点击“支持”时,它们会被隐藏起来