Code Monkey home page Code Monkey logo

flipdown's Introduction

flipdown's People

Contributors

joeinnes avatar pbutcher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

flipdown's Issues

line-height discrepancies

Browser implementations of line-height vary subtly. For example, the current values render fine in Chrome, but in Firefox, values are shifted upwards slightly.

Small Version?

Would be nice if this has a small and very small version. As small as the one that can be used in a product promotion list or sale list.

Note: this is the best countdown I've used. Thank you for this.

Numbers not showing on the flipdowns

Hi,

I am trying to integrate a flipdown clock on our website. I tried the simple example and the flipdown clock is visible. I do not get any javascript errors. But the clock does not show the numbers, i see only empty "flip cards". see image:

image

What am i doing wrong?
Niels

When the clock hits zero

Have the following options when the clock hits zero:

  • Stay at 00:00:00
  • Count up with '+' at the start
  • Move on to a new timestamp from a list

Installing FlipDown in a ReactJs Application

I already installed the library using npm, but I can't access the FlipDown component.
I don't want to change the source code, but at the same time, I don't have much experience incorporating JS libraries in React code.

I tried the code below but doesn't work.

import FlipDown from 'flipdown';
import { FlipDown } from 'flipdown';

Is it possible to import and use the methods to start the counter?

Plural/Singular ..

While it maybe good to have a translation, see #13
I do not think that it wil be a good idea to translate the strings via css.
Same goes to the English strings inside the css.

Why?

For example (currently via CSS):

English:
1 Days 1 Hours 1 Minutes 59 Seconds
German:
1 Tage 1 Stunden 1 Minuten 59 Sekunden

Reads very unprofessional!

I think (as it is at many much bigger scripts) that it will be better, to have the few language strings as external javascript and initialize the main script with English strings.
If an option is set, for example
{ lang: 'de' }

the translation is loaded (if not exist, the default EN vars are used).
This way everybody can translate in every language he wants, and you have no additonal work - but could provide a professional plugin.

And doing it this way, singular and plural language strings can be assigned and used very easily.

Reverse function count up instead down

I would need a counter which counts since when I'm sober so that it counts from a certain date up and not down.
Is that something what we could possible integrate into this library it would make it even more attractive.

I'm not that good with js but maybe I should have a look at it? But would rather let someone professional try to implement this feature. This would be for my personal website/blog handy.

If you got any questions just hit me up.

Kind regards,
Daniel Oberlechner

Can I use this on Vue.js ?

Hi, I want to use flipdown on Vue.js.
But I still don't know how to set up on my project.
The error message is "FlipDown is not defined", I think it's actually flipdown doesn't export module...
How should I do?
Please help me! :)

if container div doesn't exist, don't error

if this doesn't exist

<div id="flipdown" class="flipdown"></div>

there's an error

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'classList')
    at FlipDown._setOptions 

Please do a check and return cleanly (stop) if no container node.

Cannot find name 'FlipDown'

Hello, i was using Flipdown on a nuxt 2 project, where everything was working correctly, when migrated to nuxt 3 Flipdown is no longer working.
now i'm getting this error .
Screenshot 2023-12-12 at 15 37 37

This is how i'm using it
Screenshot 2023-12-12 at 15 38 28

IE support

Recently i tried to display my site in IE and I noticed that flipdown did not work, please update the code so we can use it on this browser. Thanks

note: It seems there is a problem when loading ES format.
flipdown error with ES

Support Angular

Hello,

I'd like to know if there is any way that this code work with angular 10.
Did you have any idea on how I should implement it please ?

I have try to viewChild and assign Flipdown to it

@ViewChild('flipdown') flipdown: ElementRef;

And also _createClass from Flipdown.

bug:day change to 100

if day change to 100, the count down show not correct values

var twoDaysFromNow = (new Date().getTime() / 1000) + (86400 * 100) + 1

Headers under instead of above

Hello and thank you for your plugin it works really well!

Is there a way to have .rotor-group-heading at the end (bottom) instead of first (on top)? If I need to modify the JS please tell me what line and I'll do it on my end.

Thank you so much!

Support for 3 digit number of days without line break

When there are more than 100 days in the counter the flipdown automatically line-breaks to make it's width 510px as set in css file.
image

More than 100 days until something happens is not uncommon and it would be nice if the default css supported it.

Animation is out of sync in Safari

The numbers change before the flip animation completes.

You must add -webkit-backface-visibility: hidden; to your css for front and rear rotor leaves, because backface-visibility alone is not supported by ios/Safari.

How to set multiple instances and theme opt?

Just having a look at your code, and seems I'm unable to do this(?)

class FlipDown {
  constructor(uts, el = "flipdown", opt = {}) {
    ...
    // If opt is specified, but not el
    if (typeof el === "object") {
      opt = el;
      el = "flipdown";
    }
    ...

However, I suppose I could do the following:

var flipdown = new FlipDown(timestamp, {
  theme: "orange"
});

flipdown.element = document.getElementById("flipdown")

// Start the countdown
flipdown.start()

Seems like opts could do with an el property? Or document the above? Perhaps this is a feature request, I dunno. Anyway, just wanted to raise it as I'm having to work out how to do this.

Great timer btw, getting me lots of brownie points ;)

ES Module support

Add support for FlipDown as an ES module with Webpack or Rollup as suggested in #11.

Mobile friendly

Accommodate different screen sizes. Allow for specifying sizes.

Add option to choose countdown unit

Hello Sir,

Thank you for your awesome work which makes my life easier. However, I have a proposal to make it even more awesome. I suggest to add an option for choosing an upper-limit count down unit. What I mean is, like right now, the upper limit unit is days. What if I want a count-down based on month. Or just based on hours, minutes and seconds. Such as the image below:

image
Again, thanks for your hard work

Would be awesome to easily scale the FlipDown

Awesome work here. This is the best looking and most performant JS Flip-style clock I've found. I'm integrating it into a site and I found that to handle small mobile devices I would need a custom @media breakpoint with a bunch of custom CSS to scale things down.

It'd be a great feature to have a way to scale it dynamically using maybe a percentage value as an option passed into the constructor: new FlipDown()

Here's what I ended up doing:

@media (max-width: 576px) {
  .flipdown .rotor {
    font-size: 2.5rem;
  }

  .flipdown .rotor,
  .flipdown .rotor-leaf,
  .flipdown .rotor-leaf-front,
  .flipdown .rotor-leaf-rear,
  .flipdown .rotor-top,
  .flipdown .rotor-bottom,
  .flipdown .rotor:after {
    width: 30px;
  }

  .flipdown .rotor-group:nth-child(n+2):nth-child(-n+3):before,
  .flipdown .rotor-group:nth-child(n+2):nth-child(-n+3):after {
    left: 76px;
  }

  .flipdown .rotor-group:nth-child(n+2):nth-child(-n+3):before {
    bottom: 19px;
    height: 8px;
    width: 8px;
  }

  .flipdown .rotor-group:nth-child(n+2):nth-child(-n+3):after {
    bottom: 35px;
    height: 8px;
    width: 8px;
  }

  .flipdown .rotor-leaf-front,
  .flipdown .rotor-top {
    line-height: 60px;
  }

  .flipdown .rotor-leaf,
  .flipdown .rotor {
    height: 60px;
  }

  .flipdown .rotor-leaf-front,
  .flipdown .rotor-leaf-rear,
  .flipdown .rotor-top,
  .flipdown .rotor-bottom,
  .flipdown .rotor:after {
    height: 30px;
  }
}

How do I need to set up the animation if the numbers are transparent in my code?

Hello! Thank you for a great project! I want to change it a little, make the numbers transparent so that the background can be seen through them. I did it, but now the animation is not working correctly. Could you help me with this? How do I make everything look beautiful and make the animation work correctly? Thanks
https://codepen.io/algorush/pen/LYyqOQz

By the way, I made the numbers transparent by adding this line for the classes:

/* Rotor tops */
.flipdown.flipdown__theme-dark .rotor,
.flipdown.flipdown__theme-dark .rotor-top,
.flipdown.flipdown__theme-dark .rotor-leaf-front {
  color: #FFFFFF;
  background-color: #151515;
  mix-blend-mode: multiply; /* -------------added this for transparent numbers-------------*/

.stop() method?

It's a very good project, I found it much easier in use then FlipClock.js which I used before (and it also requires jQuery).
But I was surprised when I did not see any sign of a stop() method which would be useful in a big complex projects when you need to stop the counter earlier then the deadline occurs according to some app logic.

good to have a counter which increase or decrease to updated value

Hi,
What you have done so good.
But it will be good to have a counter also, which increase or decrease to updated value not instantly but it should show some flip anmation before updating the value and stops at updated value.
Ex: var counter = new Counter(some initial value);

counter.IncrementTo(updated value, transistionTime);

suppose my current value is 3 and called incrementTo function with value of 10 and transition time of 3sec, It should show animation like changing from 3,4,5,6...and it should stop at 10.

I know it is a lot of work, But it will be a very good enhancement for your pliugin.

Regards,
Vijay

Optimize Responsive Behavoir

I've used your fantastic lib in multiple projects now, and I came across some responsive issues.

Beyond some Ideas to improve this, probably in a new Major release (I think this will need markup changes, so it would destroy existing countdowns with custom style) :

  1. Switch from Text-Numbers to SVG-Numbers: I think this is the most important point here, if multiple countdowns are used inside columns, the layout of the countdown will fail. If we have the numbers as Inline-SVG Codeblocks instead we have text who sizes with the container width. Examples: https://codepen.io/pcorey/pen/wdGcq or https://codepen.io/chriscoyier/pen/DKcad
  2. Improve the countdown layout with Flexbox: This is a perfect case to use Flexbox - I can't imagine a case where anyone wants the countdown to break apart, so it's always in one row: Days | Hours | Minutes | Seconds. To do so, we should change the Markup:
  • .rotor-group-heading => This needs to be moved to a new outer wrapper (.flipdown__group.flipdown__group--seconds or something), so the .rotors are alone in this wrapper. Furthermore this labels should be truncated (white-space:nowrap; text-overflow:ellipsis; ...) by default i think.
  • The time devider dots should be inline SVGs so they scale down with the SVG Text, so they also need a seperate wrapper
  • (Add SCSS files or use CSS variables, so themers can change colors, font-family, etc. more easy)
  • (Consider switching to BEM naming - but that's just my personal preference. I would also like to have modifier classes like bla-group--seconds ..bla-group--hours to prevent the nth-child stuff, which just make the CSS more complicated to understand)

I will hopefully find some time next month to try this out in a fork!

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.