Blueimp-gallery for wordpress modifications

By | May 12, 2014

As seen on this site, I modified version 1.1.0 of this nice plugin to the following tune:

1. Get title attribute for images not only from <A> HTML tag, but from <img> inside the <A>, where WordPress sets it.

I added in plugins/blueimp-lightbox/js/blueimp-gallery.js, just after existing line 976, which should be

                title = this.getItemProperty(obj, this.options.titleProperty);

this little snippet:

                if(!title) {
                        title = this.getItemProperty(obj.childNodes[0], this.options.titleProperty);
                }

 

2. Start by default with controls and navigation showing, as opposed to having to press Return.

Replace line 81 in blueimp-lightbox/js/jquery.blueimp-gallery.js:

        return new Gallery(links, options);

with:

        var t0g = new Gallery(links, options);
        var controlsClass = t0g.options.controlsClass;
        if (!t0g.container.hasClass(controlsClass)) {
                t0g.container.addClass(controlsClass);
                }
        return t0g;

One thought on “Blueimp-gallery for wordpress modifications

  1. Bruno

    Hi,

    If that does not work, you might also need to replace the title attribute configuration using the alt attribute, since in my version of wordpress the title attribute is actually being set using alt html tag. I replaced in plugins/blueimp-lightbox/js/blueimp-gallery.js:

    // The list object property (or data attribute) with the object title:
    titleProperty: ‘alt’,

    Thanks!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *