Giter Site home page Giter Site logo

How to make responsive? about timecircles HOT 13 CLOSED

Fatbat avatar Fatbat commented on July 19, 2024
How to make responsive?

from timecircles.

Comments (13)

wimbarelds avatar wimbarelds commented on July 19, 2024 1

You can call a rebuild, so:

$(window).resize(function(){
    $("#timer").TimeCircles().rebuild();
});

from timecircles.

Fatbat avatar Fatbat commented on July 19, 2024

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.

from timecircles.

wimbarelds avatar wimbarelds commented on July 19, 2024

If it doesn't always size accurately, that sounds like a bug (A friend reported something similar). I'll have a look at this.

from timecircles.

yuhao-nyc avatar yuhao-nyc commented on July 19, 2024

please let us know, if the responsive thing works! thanks

from timecircles.

wimbarelds avatar wimbarelds commented on July 19, 2024

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.

from timecircles.

yuhao-nyc avatar yuhao-nyc commented on July 19, 2024

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.

from timecircles.

wimbarelds avatar wimbarelds commented on July 19, 2024

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));

from timecircles.

yuhao-nyc avatar yuhao-nyc commented on July 19, 2024

will try that later, but i doubt that we gonna let me add new js libraries.

thanks for help, i really appreciate.

from timecircles.

wimbarelds avatar wimbarelds commented on July 19, 2024

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.

from timecircles.

yuhao-nyc avatar yuhao-nyc commented on July 19, 2024

javascript throttle script it is! Thanks

from timecircles.

wimbarelds avatar wimbarelds commented on July 19, 2024

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.

from timecircles.

kingRayhan avatar kingRayhan commented on July 19, 2024

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.

from timecircles.

MrHazimAli avatar MrHazimAli commented on July 19, 2024

when resize, there is error inside console and timecircles did not responsive.. any help ?
error :
error

code:
code

tq

from timecircles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.