javascript - WooCommerce - Triggering variation select with custom select boxes -
i'm trying use fancyselect.js style select boxes used on woocommerce , have managed few i'm struggling variation form on product pages.
while fancyselect triggers change event on original select box, appears affect nothing. looking @ javascript used in variations form, looks they've unbinded change event on select box , handling other way, triggering events on .variations_form
instead. can't seem work though.
my code along lines of:
$('.summary select').fancyselect().on('change.fs', function() { $(this).trigger('change.$'); $('.variations_form').trigger('woocommerce_variation_select_change'); });
i've tried triggering multiple events none seem have affect.
any ideas? thanks.
so turns out original trigger didn't work, reasons can't quite work out. however, manually triggering change event on original select box worked degree, wouldn't update fancyselect's "trigger" element. think because original select's options didn't :selected
attribute (for whatever reason). i've had add custom event fancyselect manually trigger it's updatetext()
method.
updated code:
$('.summary .options li').on('click', function(){ $('.summary select').trigger('change').trigger('select.fs'); });
and additional event fancyselect (which i'll try contribute if chance):
sel.on('select.fs', function(){ updatetriggertext(); });
cheers.
Comments
Post a Comment