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

Its not issue its question) #105

Open
gonardfreeman opened this issue Jan 12, 2017 · 5 comments
Open

Its not issue its question) #105

gonardfreeman opened this issue Jan 12, 2017 · 5 comments

Comments

@gonardfreeman
Copy link

gonardfreeman commented Jan 12, 2017

Works fine for me, except passing options to out animation, but I'm make data-out-animation and all works fine. I've got question, if I'm getting text from getJSON and I'm need to refresh that texts, how can I use your plugin to remove old text, and then animate new?
Here some of my code, below
$.getJSON(url+count) .done(function(data){ $('#text').text($(data[0]['content']).text().toUpperCase()).textillate({ in:{ effect: 'fadeInLeft', callback: function(){ console.log('animate in'); } }, }); $('#title').text(data[0]['title']).textillate('start'); }) .fail(function(){ console.log('ERROR'); });

$.getJSON(url+count) .done(function(data){ $('#text').text($(data[0]['content']).text().toUpperCase()).textillate({ in:{ effect: 'fadeInLeft', callback: function(){ console.log('animate in'); } }, }); $('#title').text(data[0]['title']).textillate('start'); }) .fail(function(){ console.log('ERROR'); }); $('#new_click').on('click',function(e){ $('#text').textillate('out'); $('#title').textillate('out'); e.preventDefault(); count++; $('#text').on('outAnimationEnd.tlt', function(){ //$('#text').empty(); $.getJSON(url+count) .done(function(data){ $('#text').text($(data[0]['content']).text().toUpperCase()).textillate('in'); $('#title').text(data[0]['title']).textillate('start'); }) .fail(function(){ console.log('ERROR'); }); }); });

@jschr
Copy link
Owner

jschr commented Jan 12, 2017

hey @gonardfreeman, right now I don't believe textillate makes this easy and would probably rely on a proper reset / destroy method (#80).

The cleanest way may be to create a new textillate for the new texts and remove (or manually fade out) the old textillate element.

If you do get this working please post back here for other users to benefit from. I'm also happy to accept any PRs that would make this easier.

Good luck!

@jschr
Copy link
Owner

jschr commented Jan 12, 2017

also, thanks for responding to other issues... I don't have much free time at the moment so they've been piling up.

@gonardfreeman
Copy link
Author

@jschr no problem)

@gonardfreeman
Copy link
Author

@jschr ha! solved!)) to new getJSON just added $('#text').removeData(); #80 <-- this help me a lot)

@jschr
Copy link
Owner

jschr commented Jan 12, 2017

Awesome, glad to hear it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants