--- uc_option_image.js 2009-10-04 10:36:22.000000000 +0200 +++ uc_option_image.corrected.js 2010-02-22 20:54:49.000000000 +0100 @@ -1,6 +1,24 @@ var UCOI = UCOI || {}; +jQuery.fn.uc_ucoi_attach = function() { + // Selects + $('select.form-select', this).change(function(){ + if (aid = UCOI.getAID(this)){ + UCOI.switchImage(aid, this, Drupal.settings.UCOI.size); + } + }); + + // Radios + $('.form-radios input', this).click(function(){ + if (aid = UCOI.getAID(this)){ + UCOI.switchImage(aid, this, Drupal.settings.UCOI.size); + } + }); + return this; +} + + /** * Initialize. */ @@ -14,6 +32,7 @@ UCOI.init = function() { this.use_lightbox = Drupal.settings.UCOI.use_lightbox; this.nodeid = Drupal.settings.UCOI.nodeid; +/* // Selects $('.add-to-cart select.form-select').change(function(){ if (aid = UCOI.getAID(this)){ @@ -27,6 +46,7 @@ UCOI.init = function() { UCOI.switchImage(aid, this, size); } }); +*/ //onload functions //$('.add-to-cart .form-radios input').onload(function(){ @@ -34,6 +54,7 @@ UCOI.init = function() { // UCOI.switchImage(aid, this, size); // } //}); + $('.add-to-cart').uc_ucoi_attach(); };