To-Do-List 1.21

by velo_ninja

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dynamic Divs</title>
    <style>   
    </style>

    <script>
    	function createDiv(id,title,color) {
        const div = document.createElement('div');
        div.id = id;
        div.classList.add('cell');
        div.textContent = title;
        div.style.backgroundColor = color;
        div.style.borderColor = color;
        div.style.borderRadius = '2px';
        div.style.display = 'flex';
        div.style.alignItems = 'center';
        div.style.justifyContent = 'center';
        return div;
      }    
     
      function createRow(basicData, parentElement) {
        const row = document.createElement('div');
        row.classList.add('row');
        for (let i = 0; i < basicData.percentages.length; i++) {
          const div = createDiv(basicData.ids[i], basicData.titles[i], basicData.colors[i]);
          div.style.flexBasis = `${basicData.percentages[i]}%`;
          if (parentElement) {
            parentElement.appendChild(div);
          } else {row.appendChild(div);}
        }
        if (!parentElement) {return row;}
      }      
            
      function generateRows(data) {
        const body = document.body;
        for (const [key, value] of Object.entries(data)) {
          const row = createRow(value);
          body.appendChild(row);
        }   
      }      
      
      function createRepeatedBlocks(data1, data2) {
      	 // Generate toggle buttons for each divToggle
      	const toggleButtons = createToggleButtons(data2);
     		generateToggleButtons(toggleButtons);
        
        let divMain, divCon1, divNote;
        for (const key in data1) {
          const rowData = data1[key];
          const percentages = rowData.percentages;
          for (let i = 0; i < rowData.ids.length; i++) {
            const div = createDiv(rowData.ids[i], rowData.titles[i],...

CSS

/* Your existing styles */
    #divToDoList {
      font-family: Arial, sans-serif;
      margin: 0;
      padding: 10px;
      color: black;
      font-size: 25px;
    }
    .row {display:flex; margin-bottom:10px;}
    .cell {flex-grow:1; padding:10px; border:1px solid black;}

    /* High-quality button styles */
    .button {
      margin: 10px;
      padding: 5px 10px;
      font-size: 18px;
      font-weight: bold;
      color: #fff;
      background-color: #4CAF50;
      border: none;
      border-radius: 25px;
      cursor: pointer;
      position: relative;
      overflow: hidden;
      transition: all 0.4s ease;
      z-index: 1;
    }
    
    .button:before {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 300%;
      height: 300%;
      background-color: rgba(255, 255, 255, 0.1);
      border-radius: 50%;
      transition: all 0.4s ease;
      z-index: 0;
      transform: translate(-50%, -50%);
      opacity: 0;
    }
    
    .button:hover:before {
      width: 0;
      height: 0;
      opacity: 1;
    }
    
    .button span {
      position: relative;
      z-index: 1;
    }
    
    .button::after {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 200%;
      height: 200%;
      background-color: rgba(255, 255, 255, 0.1);
      border-radius: 50%;
      transition: all 0.4s ease;
      z-index: 0;
      transform: translate(-50%, -50%);
      opacity: 0;
    }
    
    .button:hover::after {
      width: 0;
      height: 0;
      opacity: 1;
    }
    
    .button:hover {
      transform: translateY(-5px);
      box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    }