Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('.vertical .progress-fill').each(function(){
- var toFirst = $(this).find("span.to").html();
- var to = parseInt(toFirst); //Transforms sting into number
- if (toN == 2018) {
- to = 100;
- } else if (toN == 2019) {
- to = 89;
- } else if (toN == 2020) {
- to = 78;
- } else if (toN == 2021) {
- to = 66.5;
- } else if (toN == 2022) {
- to = 55;
- } else if (toN == 2023) {
- to = 43.5;
- } else if (toN == 2024) {
- to = 32.5;
- } else if (toN == 2025) {
- to = 21;
- } else {
- to = 9.5;
- }
- var fromFirst = $(this).find("span.from").html();
- var fromN = parseInt(fromFirst);
- if (fromN == 2018) { //This doesn't work. Returns just the first number
- from = 100;
- } else if (fromN == 2019) {
- from = 89;
- } else if (fromN == 2020) {
- from = 78;
- } else if (fromN == 2021) {
- from = 66.5;
- } else if (fromN == 2022) {
- from = 55;
- } else if (fromN == 2023) {
- from = 43.5;
- } else if (fromN == 2024) {
- from = 32.5;
- } else if (fromN == 2025) {
- from = 21;
- } else {
- from = 9.5;
- }
- console.log(from); //Just to see if it's returning the correct dates
- console.log(to); //Just to see if it's returning the correct dates
- var percentFrom = from + "%";
- var pBottom = 0 + ( from.slice(0, from.length - 1) );0
- var pTop = 100 - (to) + "%" ;
- var bottom = (pBottom) + "%";
- var top = (to - from) + "%";
- $(this).parent().css({
- 'height' : top,
- 'top' : pTop,
- 'bottom' : percentFrom,
- });
- });
Add Comment
Please, Sign In to add comment