mreq / slick-lightbox

A lightbox wrapper for Ken's amazing slick carousel.
http://mreq.github.io/slick-lightbox/
MIT License
229 stars 103 forks source link

How to prevent "slick-hide-init" class from being added? #17

Closed kpmanuel closed 8 years ago

kpmanuel commented 8 years ago

On iOS Chrome, the class "slick-hide-init" is added to the container and prevents the lightbox from displaying.

<div class="slick-lightbox slick-hide-init">

How can I prevent this from happening?

mreq commented 8 years ago

Please provide a minimal example on jsfiddle or a similar site.

kpmanuel commented 8 years ago

It looks like on line 70-78 on slick-lightbox.js, this is being added. Is there a way to turn that off without hacking the vendor code?

    SlickLightbox.prototype.createModal = function(index) {

      /* Creates a `slick`-friendly modal. Rearranges the items so that the `index`-th item is placed first. */
      var html, links;
      links = this.createModalItems(index);
      html = "<div class=\"slick-lightbox slick-hide-init" + (this.isIE ? ' slick-lightbox-ie' : '') + "\" style=\"background: " + this.options.background + ";\">\n    <div class=\"slick-lightbox-inner\">\n      <div class=\"slick-lightbox-slick slick-caption-" + this.options.captionPosition + "\">" + (links.join('')) + "</div>\n     <button type=\"button\" class=\"slick-lightbox-close\"></button>\n  <div>\n<div>";
      this.modalElement = $(html);
      return $('body').append(this.modalElement);
    };
mreq commented 8 years ago

Is that a bug or a specific request for your site? In case of the latter, you should be asking on http://stackoverflow.com/, not here. The code is working fine as you can see in the demo.

There's no option for that, as you can see in the docs. You do have to "hack the vendor code" by removing the class in one of the events' callback.