I have a views slideshow on the front page of the site.

In the "performance" admin area (where you can set things like page caching etc, in admin/configuration/development/performance), if I select the "Aggregate JavaScript files" checkbox, and then save the configuration, the slideshow stops rotating.

The only way I can get the slideshow to work is to leave the "Aggregate JavaScript files" box unchecked.

Is this expected?

Comments

joelstein’s picture

I have the same problem when aggregating Javascript, and saw the following error in my console:

"Uncaught SyntaxError: Unexpected token <"

When I disabled Views Slideshow, the error went away. When inspecting the error, I saw a bunch of Javascript files aggregated into one file, but where the error occurred, I saw an HTML page mashed in there (which is obviously throwing the error). It appeared Views Slideshow was adding an HTML page to the aggregated Javascript file?

In my case, my sites/all/libraries/json2.js file actually contained the wrong information. It had some HTML in there, but not Javascript. Don't know why, but replacing it with the actual json2.js file fixed the error for me. You might check that out.

petey318’s picture

Status: Active » Closed (fixed)

Thanks joelstein - that was exactly the problem.

I don't really know how I got hold of an incorrect version of json2.js, since I thought I had followed the instructions for download and installation correctly.

But manually locating the file and replacing it with the correct one fixed the problem.

b8x’s picture

Thanks for the solution problem occurred because on the page https://github.com/douglascrockford/JSON-js we save file "json2.js" using the menu item when right click and this is not correct. we must select the json2.js file code and paste it in our file.

urlM’s picture

Pasting the code into the file worked for me to get the js aggregation working with views slideshow. Thank you!

RaulMuroc’s picture

Should we work on Views Slideshow to avoid this bug.

Or is already commited a solution?

petey318’s picture

I think Views Slideshow is OK - see comment #3 above; you just need to include the correct json code. (and not all installs of views slideshow will need this anyway)