Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to reinitialize donutty #1

Closed
dusanstojanovic opened this issue Nov 21, 2018 · 1 comment
Closed

How to reinitialize donutty #1

dusanstojanovic opened this issue Nov 21, 2018 · 1 comment
Labels
question Further information is requested

Comments

@dusanstojanovic
Copy link

... on ajax loaded page? I'm using it with data attributes.

@simeydotme
Copy link
Owner

simeydotme commented Nov 24, 2018

hey :)

Usually a question of this sort will be answered faster on Stack Overflow, but here;


If you're using it with jQuery;

$("[data-donutty]").donutty();

and this should use all your data attributes for config.


If you're using with vanilla;

var $donuts = document.querySelectorAll( "[data-donutty]" );
Array.prototype.forEach.call( $donuts , function( $el ) {
    var options = JSON.parse( JSON.stringify( $el.dataset ) ),
          instance = new Donutty( $el, options );
    $el.dataset.donutty = instance;
});

these are both referenced from the /src/ directory :)
hope that helps.

@simeydotme simeydotme added the question Further information is requested label Nov 24, 2018
@simeydotme simeydotme pinned this issue Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants