Skip to content

compatibility with query string images for video detection upgrade. (fix included) #97

@HawkenKing

Description

@HawkenKing

If you are detecting images or videos and an image is loaded with a query string, for example in wordpress with a plugin, the lightbox can default to a video iframe if your code is augmented to run videos.

Here is a fix to keep images from turning into iframes when they have a query string url:

SlickLightbox.prototype.detectImage = function(url) {
    // Remove query string 
    url = url.split('?')[0];

    // Returns true if it finds an image file extension
    return url.match(/\.(jpeg|jpg|gif|png|webp)$/i) !== null;
};

Also added support for webp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions