-
Notifications
You must be signed in to change notification settings - Fork 1
Attaching plugins and classes with parameters
Nic Bell edited this page Jun 21, 2013
·
5 revisions
###jQuery
<div data-attach="Carousel" data-carousel-options='{ "width": 100 }'>
..
</div>
Attach.add('Carousel', function(el){
new Carousel($(el), $(el).data('carousel-options'));
});
$(document).ready(function(){
Attach.run();
});
###MooTools
<div data-attach="Carousel" data-carousel-options="{'width': 100}">
..
</div>
Attach.add('Carousel', function(el){
new Carousel(el, JSON.decode(el.get('data-carousel-options')));
});
window.addEvent('domready', function () {
Attach.run();
});