fancybox icon indicating copy to clipboard operation
fancybox copied to clipboard

Autostart feature breaks when script is combined

Open RobinClowers opened this issue 12 years ago • 4 comments

I'm using the Rails asset pipeline to combine all my scripts into a single file. This breaks fancybox completely because of this:

if ($("script[src*='jquery.fancybox.js']").attr('src').match(/autorun/) ){

The attr call returns undefined, so this throws.

RobinClowers avatar Oct 17 '14 23:10 RobinClowers

Yes, I also am experiencing this error, commenting it out solves it for me. Would love to see some resolution to this issue.

michaelryanmcneill avatar Mar 27 '15 00:03 michaelryanmcneill

Agreed. I am not sure how to fix this? Are you suggesting commenting the entire if block?

/* if ($("script[src*='jquery.fancybox.js']").attr('src').match(/autorun/) ){ $("a[href$='.jpg'],a[href$='.png'],a[href$='.gif'],.fancybox").attr('data-fancybox-group', 'gallery').fancybox(); } */

vikasjayaswal avatar Jun 08 '15 04:06 vikasjayaswal

This would at least keep it from breaking everything without removing the feature.

var src = $("script[src*='jquery.fancybox.js']").attr('src')
if src && src.match(/autorun/) ){
  ...
}

The autostart feature still wouldn't work if it was combined, but I'm ok with that.

RobinClowers avatar Jun 08 '15 18:06 RobinClowers

Hi, please, upgrade to v3.

fancyapps avatar Feb 28 '17 09:02 fancyapps