benignware / jquery-countimator

Animated counter
28 stars 11 forks source link

reset method? #3

Open beezlebug opened 8 years ago

beezlebug commented 8 years ago

Hi Rafael, really nice work on this plugin, I like it a lot :-)

I try to use the animated wheel counter in a tab page (using http://os.alfajango.com/easytabs/). It works fine, but I ran into the problem, that when the animated wheel counter is in the second tab (for example), someone enters the page, reads the first tab (scrolling down), switches over to the second tab and scrolls down again, then there is no animation, because the wheel counter was already scrolled in (but not seen, because the visitor was reading the first tab). To solve this I would like to bind a reset.counter method to the switch tab event (or add a check for the visability of the counter when scrolled in). Sadly I have no clue how to do this.

(sorry for my bad english)

All the best

rexblack commented 8 years ago

I'm very sorry, but i missed this. Of course my answer will be too late, but i comment on this, since there may be others that have a similar problem. I suggest to listen to desired events of the involved component and then trigger an update on countimator as described in the 'Trigger update'-section of the README.md. Unfortunately jquery-easytabs doesn't seem to fire a notification when a tab is just shown, only before and after the transition. But you could listen to the before-event and then do your action after a short delay using window.setTimeout. I think that this is not an issue with countimator. The API-methods should be used to integrate countimator with your application. As far as i know, there's currently no native event that fires when an element gets visible. Thank you very much for your contribution