Hi,
if you add flexslider manually (which is required in some cases where flexslider_add() does not work properly), the for-loop in the following file is a problem, because it assumes, that settings.flexslider exists. It would be more tough, if a check could be added, like:
if(typeof settings.flexslider != 'undefined'){
The JS error without this line:
Error: TypeError: settings.flexslider is undefined
File: ..../sites/all/modules/contrib/flexslider/assets/js/flexslider.load.js?mjwy8f
Line: 8
assets/js/flexslider.load.js:
(function ($) {
// Behavior to load FlexSlider
Drupal.behaviors.flexslider = {
attach: function(context, settings) {
var sliders = [];
for (id in settings.flexslider.instances) {
Result:
(function ($) {
// Behavior to load FlexSlider
Drupal.behaviors.flexslider = {
attach: function(context, settings) {
var sliders = [];
if(typeof settings.flexslider != 'undefined'){
for (id in settings.flexslider.instances) {
if (settings.flexslider.optionsets[settings.flexslider.instances[id]] !== undefined) {
if (settings.flexslider.optionsets[settings.flexslider.instances[id]].asNavFor !== '') {
// We have to initialize all the sliders which are "asNavFor" first.
What's your oppinion about that?
Flexslider works absolutely great with this line added and it gives you a lot of flexibility. The possibility to add flexslider manually is also proposed in the README.txt.
Is it worth a patch for a following .dev-release?
Comments
Comment #1
gmclelland CreditAttribution: gmclelland commentedYou might want to check out #1929696: drupal_add_library('flexslider', 'flexslider') no longer works.. I think it is supposed to fix the flexslider_add().
This is also a duplicate of #1938582: Uncaught TypeError: Cannot read property 'instances' of undefined
Please reopen if you feel this is not the case.
Comment #2
gmclelland CreditAttribution: gmclelland commentedSorry, your right this is a separate issue that still needs work.
Here is what you suggested in a patch. It fixes the problem for me.
Comment #3
bkonetzny CreditAttribution: bkonetzny commentedRewritten to use $.type() for type checks and updated attribute removal to chained call.
Comment #4
bkonetzny CreditAttribution: bkonetzny commentedModified type check.
Comment #5
kenorb CreditAttribution: kenorb commentedTested and it seems to work.
Comment #6
minorOffense CreditAttribution: minorOffense commentedCommitted.
Thanks everyone!
Comment #6.0
minorOffense CreditAttribution: minorOffense commentedAdded result code