Live Coronavirus (COVID-19) Statistics Widget - Covid19stats.js

Live Coronavirus (COVID-19) Statistics Widget - Covid19stats.js
File Size: 117 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Covid19stats.js is a jQuery plugin to create a coronavirus (COVID-19, SARS-CoV-2) statistics widget that fetches data from coronavirus-tracker-api and displays confirmed cases, deaths, and recovered patients by country.

How to use it:

1. Load the covid19.css for the basic styling of the widget.

<link href="dist/css/covid19.css" rel="stylesheet" />

2. Create a container to hold the widget.

<div id="covid-widget"></div>

3. Load the covid19stats.js after loading jQuery library.

<script src="/path/to/cdn/jquery.min.js"></script>
<script src="/path/to/dist/js/covid19stats.js"></script>

4. Initialize the plugin on the container element you just created and determine the ISO Country Code to filter coronavirus (COVID-19, SARS-CoV-2) statistics data by country.

$.covid19stats({
  element: "#covid-widget", 
  countryCode: "IT"
});

5. Determine whether to show confirmed cases, deaths, and recovered patients. Default: true.

$.covid19stats({
  element: "#covid-widget", 
  countryCode: "IT",
  showCases: true,
  showDeaths: false,
  showRecovered: true
});

6. Determine whether to show a Coronavirus image in the widget. Default: true.

$.covid19stats({
  element: "#covid-widget", 
  countryCode: "IT",
  showImg: false
});

7. Determine whether to show the 'Covid19 Stats' label. Default: true.

$.covid19stats({
  element: "#covid-widget", 
  countryCode: "IT",
  showRightLabel: false
});

This awesome jQuery plugin is developed by fraxool. For more Advanced Usages, please check the demo page or visit the official website.