Is there a way to create a JavaScript only widget (Like JQuery effect) which can be bound to any existing HTML element in a way which supports assigning more then one such widget to a single element.
I saw an example of code using
but with this method only one JavaScript widget can be bound.
Following is how JQuery supports multiple JavaScript behavior
When using Marko Widgets to build UI components you are using Marko Widgets to facilitate binding behavior to rendered DOM elements. Marko Widgets will invoke your initializer at the appropriate time and you are free to attach your own behavior however you want. This may include using jQuery plugins or calling code in another JavaScript module as shown below:
var fancyEffect = require('./fancy-effect');
module.exports = require('marko-widgets').defineComponent({
// ...
init: function() {
var el = this.el;
$(el).effect1().effect2();
fancyEffect.enable(el);
}
});
Is there a way to create a JavaScript only widget (Like JQuery effect) which can be bound to any existing HTML element in a way which supports assigning more then one such widget to a single element.
I saw an example of code using
Following is how JQuery supports multiple JavaScript behavior
When using Marko Widgets to build UI components you are using Marko Widgets to facilitate binding behavior to rendered DOM elements. Marko Widgets will invoke your initializer at the appropriate time and you are free to attach your own behavior however you want. This may include using jQuery plugins or calling code in another JavaScript module as shown below:
Does that answer your question?
Hi @SunnyGurnani, have you had a chance to review my previous comment? Please let me know if that answers your questions. Thanks.