mercredi 13 juillet 2016

Store and retrieve chained jquery effects/objects in variable


I want to dynamically change jquery effects by storing the chained objects in a variable and concatenating to selector later, so that i have the latest required effect when it needs to exec. i store a predifined set of jquery chained effects - fadeOut().end().next().fadeIn() - in the data-effect attr, which can change, so i need to reference back to it via a variable to add the effects to $(contentDiv) selector. So something like; $(selector)effect, won't work.

var effects = document.getElementById('effect').getAtttribute('data-effect');
$(contentsDiv).effects;

Aucun commentaire:

Enregistrer un commentaire