I have a page which contains a slideshow. It uses the views_slideshow_cycle component. However I am getting the following JS error:

Uncaught TypeError: amountVisible.indexOf is not a function

It happens on page load and then each time the browser window is resized.

The offending line is 584 in views_slideshow/contrib/views_slideshow_cycle/js/views_slideshow_cycle.js

I've output amountVisible and it is a Number. The code though looks for a '%' sign (in case the user wants a percent based value). My fix was to set amountVisible's type as a String using String(amountVisible). This seems to have worked but I was wondering if anyone had run across this issue before and could shed some light.

I have attached the patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dowdy123 created an issue. See original summary.

kpoornima’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, views_slideshow_cycle-amountvisible-indexof.patch, failed testing.

NickDickinsonWilde’s picture

Status: Needs work » Fixed

Thanks for the report and patch! I implemented it slightly differently - checking if string first, but meant it was next to no work to do so.

  • NickWilde committed f840a7a on 7.x-3.x
    Issue #2577519 by dowdy123, NickWilde: JS error on page load
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.