cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
               <div class="svg-container">
        <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="500" height="500" xml:space="preserve">

    <g class="g-tag">

      <path class="st0" d="M178.9,254.8c1.2,1.6,1.8,4.2,1.8,7.7v1.6c0,4-0.9,6.9-2.7,8.7c-1.8,1.8-4.3,2.8-7.5,2.8l-33.8,0
        c1.5-1.5,2.2-3.2,2.2-5v-30.1c0-1.8-0.8-3.5-2.3-5h33.8c3.2,0,5.7,0.9,7.5,2.8c1.8,1.8,2.7,4.8,2.7,8.8
        C180.8,250.6,180.2,253.2,178.9,254.8z M162.5,251c0.8,0,1.4-0.1,1.8-0.3c0.2-0.1,0.4-0.8,0.4-1.9v-0.2l0-2.9v-0.2
        c0-1.2-0.1-1.8-0.4-1.9c-0.4-0.2-1-0.3-1.8-0.3h-8.1l0,7.6H162.5z M154.4,258.7l0,9.1h8.1c0.8,0,1.4-0.1,1.8-0.3
        c0.2-0.1,0.4-0.8,0.4-1.9v-4.7c0-1.2-0.1-1.8-0.4-1.9c-0.4-0.2-1-0.3-1.8-0.3H154.4z"/>

      <path class="st1" d="M181.4,275.6c1.5-1.5,2.2-3.2,2.2-5v-30.1c0-1.8-0.8-3.5-2.3-5h19.9c-1.5,1.5-2.2,3.1-2.2,5v27.3H213
        c1.9,0,3.9-0.4,6.1-1.1l-1.8,8.8L181.4,275.6z"/>

      <path class="st2" d="M233.8,240.8c0.3-0.9,0.5-1.7,0.5-2.3c0-1-1.9-1.9-5.8-2.9h25.2l13.1,36.6c0.5,1.1,1.3,2.2,2.5,3.4h-21
        c0.7-1.1,1.1-2.1,1.1-3c0-1.4-0.4-3.2-1.2-5.4l-0.7-1.9h-14.6l-2.4,6.2c-0.1,0.6-0.2,1.1-0.2,1.6c0,0.8,0.9,1.6,2.7,2.5h-14.3
        c2.1-2,3.5-4.2,4.5-6.6l9.2-24.2l0.1-0.2c0.6-1.9,1-2.9,1.1-3L233.8,240.8z M244.7,257.6l-4.2-11.6l-4.6,11.6H244.7z"/>

      <path class="st3" d="M301.3,275.6h-24.8c-3.2,0-5.7-0.9-7.5-2.7c-1.8-1.8-2.8-4.8-2.8-8.8v-16.9c0-4,0.9-7,2.8-8.8
        c1.8-1.8,4.3-2.8,7.5-2.8h24l2.6,9c-2.1-0.8-4.1-1.2-5.7-1.2H297l-12.5,0c-0.8,0-1.4,0.1-1.7,0.2c-0.3,0.2-0.5,0.9-0.5,2.1l0,19.8
        v0.2c0,1.1,0.1,1.8,0.4,1.9c0.4,0.2,1,0.3,1.8,0.3l13.2,0c1.9,0,3.9-0.4,6.2-1.1L301.3,275.6z"/>

      <path class="st4" d="M337,248l14.2,23.9c0.5,1,1.4,2.2,2.8,3.8h-20l-8.2-15.1l-3.1,3.5v6c0,2.3,0.7,4.2,2.2,5.7H305
        c1.5-1.5,2.3-3.2,2.3-5v-30.1c0-1.8-0.8-3.5-2.2-5h19.9c-1.5,1.5-2.3,3.2-2.3,5v12.3l12.6-14.9c0.2-0.2,0.4-0.4,0.4-0.6
        c0-0.2-2-0.9-5.9-1.9H352c-3.6,1.2-5.6,2-6,2.4L337,248z"/>

     <path class="st5" d="M114,333.5H88.5l0.1-0.9L89,328l-0.1-41.7c0-0.2-0.1-0.3-0.2-0.4c-3.3-2.5-6.6-4.2-6.7-4.8
      c-0.2-0.9,3.9-0.2,7.6-0.5l33.8,0.2c3.2,0,5.7,1,7.5,2.8c1.8,1.8,2.7,4.8,2.7,8.8l0,2.9c0,4-1,7-2.8,8.8c-1.8,1.8-4.4,2.7-7.5,2.7
      l-16.1-0.1l-0.1,9c0,1.8,6,16.4,7.5,17.9l-0.4-0.9l0.4,0.9 M117.5,290.7l0-0.2c0-1.2-0.1-1.8-0.3-1.9c-0.4-0.2-1-0.3-1.8-0.3
      l-8.1-0.1l0,10.5l8.1,0.1c0.8,0,1.4-0.1,1.8-0.3c0.2-0.1,0.4-0.7,0.4-1.9l0-0.2L117.5,290.7z"/>

      <path class="st6" d="M142.6,286.8c0.3-0.9,0.5-1.7,0.5-2.3c0-1-1.9-1.9-5.8-2.9h25.2l13.1,36.6c0.5,1.1,1.3,2.2,2.5,3.4h-21
        c0.7-1.1,1.1-2.1,1.1-3c0-1.4-0.4-3.2-1.2-5.4l-0.7-1.9h-14.6l-2.4,6.2c-0.1,0.6-0.2,1.1-0.2,1.6c0,0.8,0.9,1.6,2.7,2.5h-14.3
        c2.1-2,3.5-4.2,4.5-6.6l9.2-24.2l0.1-0.2c0.6-1.9,1-2.9,1.1-3L142.6,286.8z M153.5,303.6l-4.2-11.6l-4.6,11.6H153.5z"/>

      <path class="st7" d="M187.4,293.3l0,23.3v0.3c0,1.6,0.1,2.6,0.4,2.9c0.3,0.4,0.8,1,1.4,1.8h-12.1c1.5-1.5,2.3-3.2,2.3-5l0-30
        c0-1.8-0.8-3.5-2.3-5h22.5l14.9,29.8v-24.8c0-1.8-0.8-3.5-2.3-5h12.6c-1.5,1.5-2.3,3.2-2.3,5L222,346l-18-28L187.4,293.3z"/>
     
      <path class="st8" d="M252.8,289.4v27.3c0,1.8,0.7,3.4,2.2,5l-19.8,0c1.5-1.5,2.2-3.2,2.2-5v-27.3h-7.3c-1.3,0-3.1,0.8-5.4,2.3
        l1.8-10.1h36.4l2.8,10.2c-2.4-1.6-4.3-2.4-5.6-2.4H252.8z"/>

      <path class="st9" d="M284,304.7v11.9c0,1.8,0.7,3.4,2.2,5l-19.8,0c1.5-1.5,2.2-3.2,2.2-5v-30.1c0-1.8-0.8-3.5-2.3-5h19.9
        c-1.5,1.5-2.2,3.1-2.2,5V297h10.3v-10.4c0-1.8-0.8-3.5-2.3-5h19.9c-1.5,1.5-2.2,3.1-2.2,5v30.1c0,1.8,0.7,3.4,2.2,5l-19.8,0
        c1.5-1.5,2.2-3.2,2.2-5v-11.9H284z"/>

      <path class="st10" d="M329.4,297h11c1.8,0,4-0.6,6.6-1.9v11.6c-2.6-1.3-4.8-1.9-6.6-1.9h-11v9.1h13.9c1.9,0,3.9-0.4,6.1-1.1
        l-1.8,8.8l-35.8,0c1.5-1.5,2.2-3.2,2.2-5v-30.1c0-1.8-0.8-3.5-2.3-5h35.1l2.7,8.9c-2.3-0.8-4.3-1.1-6.2-1.1h-13.9V297z"/>

      <path class="st11" d="M372,307.7h-4.7l0,9c0,1.8,6.2,15.9,7.7,17.4h-25c1.5-1.5,1.9-15.6,1.9-17.4v-30.1c0-1.8-0.8-3.5-2.3-5h33.8
        c3.2,0,5.7,0.9,7.5,2.8s2.7,4.8,2.7,8.8v2.9c0,4-0.9,7-2.8,8.8c-0.8,0.8-1.6,1.4-2.3,1.7l5.7,12c0.5,0.9,4.5,13.3,5.6,14.4h-18
        L372,307.7z M377.6,291.7v-0.2c0-1.2-0.1-1.8-0.4-1.9c-0.4-0.2-1-0.3-1.8-0.3h-8.1l0,10.5h8.1c0.8,0,1.4-0.1,1.8-0.3
        c0.2-0.1,0.4-0.8,0.4-1.9v-0.2L377.6,291.7z"/>
    </g>
    <g>
    </g>

    <polygon class="st12" points="87.5,335.5 87.5,335.5 87.5,335.5 87.5,335.5 "/>
    </svg>
 </div>

    <div class="container">
        <div id="icon" class="loading_icon"></div>
        <div class="data-box">
            <h2 class="title">API Comic Search</h2>
            <p class="text">Fetches all comics that feature Black Panther within date ranges you specify</p>
            <input type="number" id="dateFirst" value="1966">
            <input type="number" id="dateSecond" value="2006">
            <input type="submit" value="GET DATA" id="getData" class="btn btn-data" />
        </div>
        <div id="result" class="grid">
            <!-- Results here -->
        </div>
    </div>
            
          
!
            
              body {
  padding: 0;
  margin: 0;
  background-image: linear-gradient(to top, #09203f 0%, #537895 100%);
  background-repeat: no-repeat;
  background-attachment: fixed; }

.container {
  margin: 0 auto;
  max-width: 1280px;
  width: 90%;
  font-family: sans-serif;
  text-align: center; }
  @media (min-width: 995px) {
    .container {
      width: 85%; } }
  @media (min-width: 650px) {
    .container {
      width: 70%; } }

.svg-container {
  position: fixed;
  transform: translate(-50%, -50%);
  top: 8.5%;
  left: 50%;
  z-index: -1; }

.st4, .st3, .st2, .st1, .st0 {
  animation: add-fill 3s linear 5s forwards; }

.st7, .st6, .st5, .st12, .st11, .st10, .st9, .st8 {
  animation: add-fill 3s linear 6s forwards; }

.loading_icon {
  background: url(/images/blk-panther.gif) no-repeat 25% 25%;
  position: absolute;
  height: 55px;
  width: 48px;
  top: 32%;
  left: 50%;
  z-index: -1;
  transform: translate(-50%, -50%);
  display: none;
  transiton: 1s all ease; }

.g-tag {
  fill: transparent;
  stroke: #222;
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: animate 7s linear forwards; }

@keyframes animate {
  100% {
    stroke-dashoffset: 0%; } }
@keyframes add-fill {
  100% {
    fill: #111; } }
.title {
  color: darkslategray;
  font-size: 1.25em; }

.text {
  color: darkslategray;
  font-size: 1em; }

.grid {
  display: grid;
  grid-template-columns: auto auto auto;
  background-color: rgba(0, 0, 0, 0.9);
  transform: translate(0, -100%);
  transition: transform 3s ease-out; }
  @media (max-width: 1150px) {
    .grid {
      grid-template-columns: auto auto; } }
  @media (max-width: 700px) {
    .grid {
      grid-template-columns: auto; } }

.revealer {
  transform: translate(0, 0); }

.darker {
  background: rgba(0, 0, 0, 0.55); }

.data-box {
  background: linear-gradient(-180deg, #BCC5CE 0%, #929EAD 98%), radial-gradient(at top left, rgba(255, 255, 255, 0.3) 0%, rgba(0, 0, 0, 0.3) 100%);
  background-blend-mode: screen;
  color: #fff;
  text-align: center;
  padding: 1em;
  margin: 5em auto 0 auto;
  border: solid 5px #BCC5CE;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%); }

.btn {
  display: block;
  width: 55%;
  margin: 0 auto;
  padding: 10px 20px;
  text-align: center;
  background: #243949;
  color: #fff;
  font-weight: bold; }
  .btn:hover {
    opacity: .7;
    cursor: pointer; }
  .btn-data {
    margin-top: 10px; }

.card {
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  transition: 0.3s;
  width: fit-content;
  padding: 1em;
  background: #fff;
  border: 2px solid #777;
  margin: auto; }
  .card:hover {
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2); }

input[type=number] {
  width: 130px;
  text-align: center;
  font-size: 1em;
  border: 2px solid #ccc;
  border-radius: 4px;
  background-position: 10px 10px;
  background-repeat: no-repeat;
  padding: 7px 20px 7px 40px;
  transition: all 0.4s ease-in-out; }
  input[type=number]:focus {
    width: 20%;
    background: black;
    color: #fff; }
            
          
!
            
              function getMarvelData() {

    let dateOne = document.getElementById('dateFirst').value,
        dateTwo = document.getElementById('dateSecond').value;


    fetch('https://gateway.marvel.com:443/v1/public/comics?format=comic&formatType=comic&noVariants=true&dateRange=' + dateOne + '-01-01%2C' + dateTwo + '-01-02&characters=1009187&limit=100&apikey=cb6378a5a3f12f56c38a8325fbfa0dcb')
        .then(function(response) {
                if (response.status !== 200) {
                    console.log('Looks like there was a problem. Status Code: ' +
                        response.status);

                    return;
                }


                // Examines the data in the response
                response.json().then(function(data) {
               

                    function createNode(element) {
                        // Creates whatever element you pass as parameters
                        return document.createElement(element);
                    }

                    function append(parent, element) {
                        // Appends the second parameter(element) to the first
                        return parent.appendChild(element);
                    }
                                  
                    // Add results to container in the end
                    let container = document.getElementById('result'),
                        marvelData = data.data.results


                        // Add animation to reveal data
                          container.classList.add("revealer");


                        // Map through the results and run code for each
                        return marvelData.map(function(marvel) {

                             // If results taking awhile...show loader
                            document.getElementById('icon').style.display = 'block';

                            // Create 3 elements
                            let div = createNode('div'),
                                img = createNode('img'),
                                par = createNode('p');

                            // Attach img and title of comic to elements  
                            img.src = marvel.thumbnail.path + '/standard_fantastic.jpg';
                            par.innerHTML = `${marvel.title}`;
                            div.classList.add("card");

                            append(div, img);
                            append(div, par);
                            append(container, div);
                        })

                           
                  
                    // Spit out results
                    output = marvelData;
 
                })
               
            })
        
        .catch(function(err) {
            console.log('Fetch Error :-S', err);
        });

}

 

document.getElementById('getData').addEventListener('click', getMarvelData);
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console