Discussions

Detect in javascript when add to cart widget updates product fields

I have a carousel of images for each product style. When the add to cart form refreshes the product images when the form fields are changed I need to setup the carousel for the new product images that have been loaded in.

Is there a way to hook into this using Drupal javascript or a special event drupal fires when adding in new content via js?

Thanks

Posted: May 21, 2013

Comments

olliebourne on May 21, 2013

found you can use something like this:

Drupal.behaviors.exampleModule = {
attach: function (context, settings) {
$('.example', context).click(function () {
$(this).next('ul').toggle('show');
});
}
};

I'd be interested to know if there's anyway to hook directly into js though