Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Dynamically change Group name in JavaScript

I am trying to use filtering on my image gallery which is using Fresco, and I am able to change the value of data-fresco-group in JavaScript. However, when the value is changed and I attempt to click on an image thumbnail I get the following error coming from the Fresco JS file: TypeError: views[0] is undefined. When the page loads (before any of the changes happen, I am able to use Fresco without error - it only happens after the data-fresco-group attribute is changed for the hyperlinks. Basically on page load all images are of the same group, but then if a user clicks on on of the filter buttons the group names change to separate certain images into certain groups. Any suggestions of how to go about this?


  • Looked into it, fixed it in 2.2.4.

    It seemed to a problem in the way Fresco accessed the data-attribute, or just something I didn't realize about jQuery, maybe even a bug on their end. When you use jQuery's data('attribute') to read out a data-attribute, it'll refer to some internal storage the second time around instead of whatever's in the DOM at that time. The only way to reliably read out a data-attribute every time is attr('data-attribute').

Sign In or Register to comment.