-
Notifications
You must be signed in to change notification settings - Fork 149
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 make responsive? #30
Comments
You can call a rebuild, so: $(window).resize(function(){
$("#timer").TimeCircles().rebuild();
}); |
That was quick! That works, but it doesn't always size accurately. I tried adding it to a smartresize function and it seems to be working a bit better, but the fonts don't seem to want to scale with the circle. |
If it doesn't always size accurately, that sounds like a bug (A friend reported something similar). I'll have a look at this. |
please let us know, if the responsive thing works! thanks |
Can you show me an example of it not working as it should? I have a test set up here: http://git.wimbarelds.nl/TimeCircles/test/ Where it seems to work perfectly. |
I did add the extra javascript line and the circles are responsively perfect, but there is a minor issue, when I resize webpage manually, the circles are flickering (or kind of twinkling). It may not a big deal, but its a little bit annoying. |
Ahh, if it's only the TimeCircles flickering- that's because the resize call is executed very very often! So it's resizing the TimeCircles possibly a hundred times in a second. That's going to cause some rendering issues/flickering. What you should ideally do is use something to either throttle the function call. If you're not opposed to adding a javascript library, then I can really recommend "underscore js" (http://underscorejs.org/) Add the following: <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script> And change the javascript to: $(window).resize(_.throttle(function(){
tc.rebuild();
}, 500)); |
will try that later, but i doubt that we gonna let me add new js libraries. thanks for help, i really appreciate. |
It's possible to create such a function yourself, just google for javascript throttle script. Underscore is simply a (pretty great) library that has that functionality out of the box. |
javascript throttle script it is! Thanks |
Since there has been no further comments or questions, I assume this has been resolved now. If not, feel free to post further questions / reopen. |
how can I make it responsive with css media quary? I want to show 4 circle in large screen and 2 circle in medium screen and one circle in small screen. |
While TimeCircles draws to fill 100% of its container when the page loads, if you resize the page and the container changes dimensions, TimeCircles remains at it's original dimensions and does not redraw itself.
Is there a way to update TimeCircles on screen resize?
I tried
but that didn't do anything. Sorry to inundate you with questions :) Your help is greatly appreciated.
The text was updated successfully, but these errors were encountered: