I love the concept of this module for a Drupal Commerce site but I use Flexslider all over the place and once I enable view mode caching flexslider starts complaining and does not render content.
The error message in console: Uncaught TypeError: Cannot set property 'targetId' of undefined
The code where the error occurs.
Drupal.behaviors.flexsliderViewsSlideshow = {
attach: function (context) {
$('.flexslider_views_slideshow_main:not(.flexslider_views_slideshow-processed)', context).addClass('flexslider_views_slideshow-processed').each(function() {
// Get the ID of the slideshow
var fullId = '#' + $(this).attr('id');
// Create settings container
var settings = Drupal.settings.flexslider_views_slideshow[fullId];
//console.log(settings);
// @todo map the settings from the form to their javascript equivalents
settings.targetId = fullId; <-------- HERE IS WHERE THE ERROR HAPPENS
settings.loaded = false;
// Assign default settings
// @todo update the list of options to match the new set
settings.opts = {
// v2.x options
namespace:settings.namespace,
selector:settings.selector,
easing:settings.easing,
direction:settings.direction,
reverse:settings.reverse,
smoothHeight:settings.smoothHeight,
startAt:settings.startAt,
animationSpeed:settings.animationSpeed,
initDelay:settings.initDelay,
useCSS:settings.useCSS,
touch:settings.touch,
video:settings.video,
keyboard:settings.keyboard,
multipleKeyboard:settings.multipleKeyboard,
mousewheel:settings.mousewheel,
controlsContainer:settings.controlsContainer,
sync:settings.sync,
asNavFor:settings.asNavFor,
itemWidth:settings.itemWidth,
itemMargin:settings.itemMargin,
minItems:settings.minItems,
maxItems:settings.maxItems,
move:settings.move,
// v1.x options
animation:settings.animation,
slideshow:settings.slideshow,
slideshowSpeed:settings.slideshowSpeed,
directionNav:settings.directionNav,
controlNav:settings.controlNav,
prevText:settings.prevText,
nextText:settings.nextText,
pausePlay:settings.pausePlay,
pauseText:settings.pauseText,
playText:settings.playText,
randomize:settings.randomize,
animationLoop:settings.animationLoop,
pauseOnAction:settings.pauseOnAction,
pauseOnHover:settings.pauseOnHover,
manualControls:settings.manualControls,
start: function(slider) {
flexslider_views_slideshow_register(fullId, slider);
}
// @todo register other callbacks
};
Drupal.flexsliderViewsSlideshow.load(fullId);
});
}
};
It looks to me like the cache is not passing/storing the ID needed in the JS to make these two work together.
Any help would be appreciated.
Comments
Comment #1
kars-t commentedHi
thanks for the report but I beleive this has nothing todo with display cache. Maybe HTML is missing because of stuff being cached and some not. Or maybe they use drupal_add_js() and the code in regards is not running anymore because we cache the HTML and it will never be called.
Sorry but I will close this.