Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />

    <!-- Bootstrap CSS -->
    <link
      href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
      rel="stylesheet"
      integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1"
      crossorigin="anonymous"
    />
    <link
      rel="stylesheet"
      href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css"
      integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p"
      crossorigin="anonymous"
    />

    <link rel="stylesheet" href="style.css" />
    <link rel="icon" href="logo.png" type="image/ico" />
    <title>Weather</title>
  </head>
  <body class="light-theme">
    <section id="nav">
      <ul>
        <li><a href="#">Home</a></li>
        <li><a href="#">About</a></li>
        <li><a href="forecast.html">Forecast</a></li>
        <li><a href="#" class="theme">Dark Mode</a></li>
      </ul>
    </section>
    <section id="main">
      <nav>
        <i class="fas fa-bars toggler"></i>
        <h2>Lucideus <i class="fas fa-cloud-meatball"></i></h2>
        <h3 id="time"></h3>
      </nav>
      <div id="popup">
        <div class="popup-flex">
          <button id="popup-btn">Click Me</button>
        </div>
              
        <div id="popup-wrapper" class="popup-container">
          <div class="popup-content">
            <span id="close">&times;</span>
            <p id="err">Please enable the GPS.</p>
          </div>
        </div>
      </div>
      
       
      <main>
        <form class="input">
          <input type="text" class="inputValue" placeholder="Enter a city" onkeypress="return runScript(event)"  />
          <button class="button">Search</button>
        </form>
        <div class=" spin">
          <div class="loader">Loading...</div>
          <p class="ml10">
            <span class="text-wrapper">
              <span class="letters">Gathering info...</span>
            </span>
          </p>
        </div>
        <div class="temp">
          <div class="label">
            <sup id="marker"><i class="fas fa-map-marker-alt"></i></sup>
            <h1 id="name"></h1>
            <sub id="country"></sub>
          </div>

          <h1 id="temp"></h1>
          <div class="min-max">
            <span id="max"></span>
            <span id="slash">/</span>
            <span id="min"></span>
            <span style="padding: 0 10px"></span>
            <span id="day"></span>
          </div>
          <span id="description"
                ><i class="fas fa-cloud"></i> <span id="desc"></span
          ></span>
        </div>
      </main>
      
      
      <div class="more">
        <div class="row container">
          <div class="col-6 col-md-3 col-sm-3">
            <h2><span id="feel"></span> <sub>°C</sub></h2>
            <p>Real feel</p>
          </div>
          <div class="col-6 col-md-3 col-sm-3">
            <h2><span id="wind"></span> <sub>km/h</sub></h2>
            <p><span id="direction"></span> wind</p>
          </div>
          <div class="col-6 col-md-3 col-sm-3">
            <h2><span id="humid"></span> <sub>%</sub></h2>
            <p>Humidity</p>
          </div>
          <div class="col-6 col-md-3 col-sm-3">
            <h2><span id="pressure"></span> <sub>hPa</sub></h2>
            <p>Pressure</p>
          </div>
          
          </div>
        </div>
      </div>
     
    </section>
    <script type="text/javascript">
      var popup = document.getElementById('popup-wrapper');
      var btn = document.getElementById("popup-btn");
      var span = document.getElementById("close");
      btn.onclick = function() {
          popup.classList.add('show');
      }
      span.onclick = function() {
          popup.classList.remove('show');
      }

      window.onclick = function(event) {
          if (event.target == popup) {
              popup.classList.remove('show');
          }
      }
    </script> 
    <script
      src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
      integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW"
      crossorigin="anonymous"
    ></script>
    <script
      src="https://code.jquery.com/jquery-3.5.1.js"
      integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc="
      crossorigin="anonymous"
    ></script>
    <script src="script.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/2.0.2/anime.min.js"></script>
    <script>
      var textWrapper = document.querySelector('.ml10 .letters');
      textWrapper.innerHTML = textWrapper.textContent.replace(/\S/g, "<span class='letter'>$&</span>");

      anime.timeline({loop: true})
        .add({
          targets: '.ml10 .letter',
          rotateY: [-90, 0],
          duration: 2000,
          delay: (el, i) => 45 * i
        }).add({
          targets: '.ml10',
          opacity: 0,
          duration: 500,
          easing: "easeOutExpo",
          delay: 500
        });
    </script>
  </body>
</html>

              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Poppins:[email protected]&display=swap");
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
  transition: background 0.3s ease-in, color 0.1s ease-out;
}
.light-theme {
  --bg: #d9e4f5;
  /* --img: linear-gradient(315deg, #d9e4f5 0%, #f5e3e6 74%); */
  --img: linear-gradient(320deg, #85a3ce 0%, #f5dadf 74%);

  --color: #000;
}

.dark-theme {
  /* --bg: #272727; */
  --bg: #000;
  --img: linear-gradient(180deg, #2c3e50 10%, #000 74%);
  --color: #fff;
}

body {
  background: black !important;
  overflow-x: hidden;
}
.hidden {
  display: none;
}
.spin {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.loader {
  color: var(--color);
  font-size: 90px;
  text-indent: -9999em;
  overflow: hidden;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  margin: 72px auto;
  position: relative;
  -webkit-transform: translateZ(0) scale(0.5);
  -ms-transform: translateZ(0) scale(0.5);
  transform: translateZ(0) scale(0.5);
  -webkit-animation: load6 2.3s infinite ease, round 2.3s infinite ease;
  animation: load6 2.3s infinite ease, round 2.3s infinite ease;
}
@-webkit-keyframes load6 {
  0% {
    box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em,
      0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
  }
  5%,
  95% {
    box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em,
      0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
  }
  10%,
  59% {
    box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em,
      -0.173em -0.812em 0 -0.44em, -0.256em -0.789em 0 -0.46em,
      -0.297em -0.775em 0 -0.477em;
  }
  20% {
    box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em,
      -0.555em -0.617em 0 -0.44em, -0.671em -0.488em 0 -0.46em,
      -0.749em -0.34em 0 -0.477em;
  }
  38% {
    box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em,
      -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em;
  }
  100% {
    box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em,
      0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
  }
}
@keyframes load6 {
  0% {
    box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em,
      0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
  }
  5%,
  95% {
    box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em,
      0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
  }
  10%,
  59% {
    box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em,
      -0.173em -0.812em 0 -0.44em, -0.256em -0.789em 0 -0.46em,
      -0.297em -0.775em 0 -0.477em;
  }
  20% {
    box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em,
      -0.555em -0.617em 0 -0.44em, -0.671em -0.488em 0 -0.46em,
      -0.749em -0.34em 0 -0.477em;
  }
  38% {
    box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em,
      -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em;
  }
  100% {
    box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em,
      0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
  }
}
@-webkit-keyframes round {
  0% {
    -webkit-transform: rotate(0deg) scale(0.5);
    transform: rotate(0deg) scale(0.5);
  }
  100% {
    -webkit-transform: rotate(360deg) scale(0.5);
    transform: rotate(360deg) scale(0.5);
  }
}
@keyframes round {
  0% {
    -webkit-transform: rotate(0deg) scale(0.5);
    transform: rotate(0deg) scale(0.5);
  }
  100% {
    -webkit-transform: rotate(360deg) scale(0.5);
    transform: rotate(360deg) scale(0.5);
  }
}
.ml10 {
  position: relative;
  font-weight: 900;
  font-size: 1em;
}

.ml10 .text-wrapper {
  position: relative;
  display: inline-block;
  padding-top: 0.2em;
  padding-right: 0.05em;
  padding-bottom: 0.1em;
  overflow: hidden;
}

.ml10 .letter {
  display: inline-block;
  line-height: 1em;
  transform-origin: 0 0;
}
section#nav {
  background: #000;
  color: #ffffff;
  max-height: 100vh;
  position: fixed;
  top: 0px;
  width: 200px;
  transition: 0.4s;
}
#nav i {
  position: absolute;
  top: 0;
  z-index: -1;
  background: #fff;
  border-radius: 50%;
  animation: animate linear infinite;
}
@keyframes animate {
  0% {
    opacity: 0;
    transform: translateY(0);
  }
  10%,
  90% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(130px);
  }
}
#nav ul {
  display: flex;
  margin-top: 100px;
  flex-direction: column;
}
#nav ul li {
  margin: 20px;
  cursor: pointer;
}
#nav ul li a {
  text-decoration: none;
  color: white;
  transition: 0.4s;
}
#nav ul li a:hover {
  border-bottom: 1px solid white;
}

#popup button {
  display: none;
  border: none;
  background: #333;
  color: #fff;
  padding: 10px 30px;
  border-radius: 5px;
  font-size: 17px;
  cursor: pointer;
  font-family: "Saira Semi Condensed", sans-serif;
}
#popup .popup-flex {
  margin: 30px;
}
#popup .popup-container {
  visibility: hidden;
  opacity: 0;
  transition: all 0.3s ease-in-out;
  transform: scale(1.3);
  position: fixed;
  z-index: 1;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(21, 17, 17, 0.61);
  display: flex;
  align-items: center;
}
#popup .popup-content {
  position: relative;
  background-color: var(--bg);
  margin: auto;
  padding: 20px;
  width: 300px;
  height: 80px;
  display: flex;
  justify-content: center;
  flex-direction: row-reverse;
  align-items: center;
  border-radius: 10px;
}
#popup .popup-content p {
  font-size: 17px;
  color: var(--color);
  padding: 10px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  /* vertical-align: middle; */
  line-height: 20px;
}
#popup .popup-content span {
  color: rgb(122, 122, 122);
  float: right;
  font-size: 28px;
  position: absolute;
  top: 0px;
  right: 10px;
  font-weight: bold;
}
#popup .popup-content span:hover,
#popup .popup-content span:focus {
  color: rgb(145, 145, 145);
  text-decoration: none;
  cursor: pointer;
}
#popup .show {
  visibility: visible;
  opacity: 1;
  transform: scale(1);
}
#popup .more-articles {
  margin: 30px 30px 50px;
  font-size: 20px;
}
#popup .more-articles a {
  margin: 0 10px;
  text-decoration: underline;
}

/* main section  */
section#main {
  position: relative;
  background: var(--bg);
  color: var(--color);
  background-image: var(--img);
  min-height: 100vh;
  width: 100vw;
  border-top-left-radius: 30px;
  top: 0;
  left: 0;
  -webkit-transition: all 0.2s linear 0s;
  transition: all 0.2s linear 0s;
}
.active {
  top: 60px !important;
  left: 200px !important;
}

#main nav {
  display: flex;
  padding: 25px;
}
#main .toggler {
  font-size: 24px;
  cursor: pointer;
}
#main nav h2 {
  font-weight: 900;
  text-transform: uppercase;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-bottom: 2px solid var(--color);
}
#main nav #time {
  position: absolute;
  right: 3vw;
  top: 32px;
  font-size: 20px;
  transition: 0.6s;
}
#main nav #time sub {
  font-size: 10px;
  position: absolute;
  bottom: 5px;
}

#main main .input {
  position: absolute;
  right: 0px;
  margin: 10px 20px;
}
#main .inputValue {
  position: relative;
  width: 200px;
  padding: 8px;
  margin: 0px;
  background-color: rgb(219, 212, 212);
  border: 0;
  border-radius: 5px;
}
#main input:valid {
  border: 0;
  outline: 0;
}
#main main .button {
  /* position: absolute; */
  outline: none;
  background: black;
  color: white;
  margin: 5px;
  padding: 8px;
  border: 0;
  border-radius: 5px;
}
#main main .temp {
  /* z-index: -1;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;*/
  text-align: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: 0.4s;
}
#main main #desc {
  text-transform: capitalize;
  font-size: 25px;
  vertical-align: middle;
}
#main main #description img {
  height: 80px;
  margin-left: -15px;
}
#main main .label {
  display: flex;
}
#main main .label sup {
  margin-top: 6px;
  font-size: 13px;
}
#main main #name {
  font-size: 42px;
  font-weight: 900;
}
#main main #country {
  font-size: 18px;
  margin-top: 36px;
  margin-left: 5px;
}
#main main #temp {
  font-size: 50px;
  position: relative;
}
#main main #temp sup {
  font-size: 22px !important;
  position: absolute !important;
  top: 20px !important;
  margin-left: 3px !important;
}
#main .more {
  position: absolute;
  margin-top: 30px;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  /* background: #000; */
}
@media screen and (min-aspect-ratio: 13/9) {
  #main .more {
    top: 70vh;
  }
}

#main .more .row div {
  display: flex;
  align-items: center;
  flex-direction: column;
}
#main .more sub {
  font-size: 15px;
}
#main .forecast .container {
  width: 90%;
  margin-top: 100px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: rgb(153, 22, 22);
}
#main .forecast .container #sicon img {
  height: 40px;
}
@media (min-width: 1000px) {
  #main .more {
    width: 65%;
  }
}
@media (max-width: 768px) {
  #main .inputValue {
    width: 150px;
    padding: 5px;
    margin: 0px;
  }
  #main main .button {
    padding: 6.5px;
    font-size: 14px;
    margin: 0;
  }
  #main nav #time {
    right: 4vw;
  }
}

@media (max-width: 500px) {
  .active {
    left: 160px !important;
  }
  #main nav #time {
    right: 8vw;
  }
}
@media (max-width: 400px) {
  #main nav #time {
    font-size: 18px;
    right: 6.3vw;
  }
  #main nav #time sub {
    font-size: 9px;
    margin-left: 2px;
  }
}
@media (max-width: 360px) {
  #main nav #time {
    font-size: 18px;
    right: 5.9vw;
  }
}

              
            
!

JS

              
                let theme = $(".theme");
let loader = $(".loader");
let txt = $(".ml10");
if (window.localStorage.theme == "dark") { document.body.classList.remove("light-theme");
  document.body.classList.add("dark-theme");
  theme.html("Light Mode");
} else {
  document.body.classList.add("light-theme");
  document.body.classList.remove("dark-theme");
  theme.html("Dark Mode");
}
$(document).ready(function () {
  let nav = $("#nav");
  let main = $("#main");
  let toggler = $(".toggler");
  let theme = $(".theme");
  $(theme).click(function () {
    // document.body.classList.toggle("dark-theme");
    if (document.body.classList.contains("dark-theme")) {
      theme.html("Dark Mode");
      document.body.classList.add("light-theme");
      document.body.classList.remove("dark-theme");
      window.localStorage.theme = "light";
    } else {
      theme.html("Light Mode");
      document.body.classList.add("dark-theme");
      document.body.classList.remove("light-theme");
      window.localStorage.theme = "dark";
    }
  });
  $(toggler).click(function (e) {
    e.preventDefault();
    $(main).toggleClass("active");
    $(this).toggleClass("fa-times");
  });
});

let button = $(".button");
let inputValue = $(".inputValue");

let Feel = $("#feel");
let Humid = $("#humid");
let Wind = $("#wind");
let Pressure = $("#pressure");
let Name = $("#name");
let Temp = $("#temp");
let Descriprion = $("#description");
let Marker = $("#marker");
let Slash = $("#slash");
let Max = $("#max");
let Min = $("#min");
let Country = $("#country");
let Desc = $("#desc");
let Day = $("#day");
let More = $(".more");
let Time = $("#time");
let Direction = $("#direction");
let Img = $("#img");
More.hide();
Descriprion.hide();
Marker.hide();
Slash.hide();
$(document).ready(function () {
  $(window).on("resize", function (e) {
    checkScreenSize();
  });

  checkScreenSize();

  function checkScreenSize() {
    var newWindowWidth = $(window).width();
    if (newWindowWidth < 600) {
      $(inputValue).focusin(function (e) {
        e.preventDefault();
        $(".temp").addClass("hidden");
        $(".more").addClass("hidden");
      });
      $(inputValue).focusout(function (e) {
        e.preventDefault();
        $(".temp").removeClass("hidden");
        $(".more").removeClass("hidden");
      });
    } else {
      $(".temp").removeClass("hidden");
      $(".more").removeClass("hidden");
    }
  }
});

function getDirection(direction) {
  if (direction > 348.75 || direction <= 11.25) {
    direction = "N";
  } else if (direction > 11.25 && direction <= 33.75) {
    direction = "NNE";
  } else if (direction > 33.75 && direction <= 56.25) {
    direction = "NE";
  } else if (direction > 56.25 && direction <= 78.75) {
    direction = "ENE";
  } else if (direction > 78.75 && direction <= 101.25) {
    direction = "E";
  } else if (direction > 101.25 && direction <= 123.75) {
    direction = "ESE";
  } else if (direction > 123.75 && direction <= 146.25) {
    direction = "SE";
  } else if (direction > 146.25 && direction <= 168.75) {
    direction = "SSE";
  } else if (direction > 168.75 && direction <= 191.25) {
    direction = "S";
  } else if (direction > 191.25 && direction <= 213.75) {
    direction = "SSW";
  } else if (direction > 213.25 && direction <= 236.75) {
    direction = "SW";
  } else if (direction > 236.75 && direction <= 258.25) {
    direction = "WSW";
  } else if (direction > 258.25 && direction <= 281.75) {
    direction = "W";
  } else if (direction > 281.75 && direction <= 303.25) {
    direction = "WNW";
  } else if (direction > 303.25 && direction <= 326.75) {
    direction = "NW";
  } else if (direction > 326.75 && direction <= 348.75) {
    direction = "NNW";
  }
  return direction;
}

let date = new Date();
let weekdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
let day = weekdays[date.getDay()];
function setTime() {
  let date = new Date();
  let Hours = date.getHours();
  Hours == 0 ? (Hours = "12") : Hours;
  let Minutes = date.getMinutes();
  let Seconds = date.getSeconds();
  Seconds < 10 ? (Seconds = "0" + Seconds) : Seconds;
  Minutes < 10 ? (Minutes = "0" + Minutes) : Minutes;
  Hours > 12 ? (Hours -= 12) : Hours;
  Hours < 10 ? (Hours = "0" + Hours) : Hours;

  // console.log(Hours + ":" + Minutes);
  Time.html(Hours + ":" + Minutes + ":" + Seconds );
}
setTime();
setInterval(setTime, 1000);
let form = $(".input");
function clickButton() {
  click_event = jQuery.Event("click");
  $(Time).trigger(click_event);
}
function runScript(e) {
  //See notes about 'which' and 'key'
  if (e.keyCode == 13) {
    return false;
  }
}
function getLocation() {
  let lng, lat;
  navigator.geolocation.getCurrentPosition((position) => {
    lng = position.coords.longitude;
    lat = position.coords.latitude;
  });
  var popup = $("#popup-wrapper");

  if (lat == null && window.localStorage.lat == null) {
    // alert("GPS not activated!");
    let error = $("#err");
    error.html("Please enable the GPS.");

    popup.addClass("show");
  } else {
    popup.removeClass("show");
  }
}
getLocation();

function stars() {
  let count = 200;
  let scene = $("#nav");
  let i = 0;
  while (i < count) {
    let star = document.createElement("i");
    let x = Math.floor(Math.random() * window.innerWidth);
    let y = Math.floor(Math.random() * window.innerHeight);
    let duration = Math.random() * 10;
    let size = Math.random() * 2;

    star.style.left = x + "px";
    star.style.top = y + "px";
    star.style.width = 1 + size + "px";
    star.style.height = 1 + size + "px";
    star.style.animationDuration = 6 + duration + "s";
    star.style.animationDelay = duration + "s";

    scene.append(star);
    i++;
  }
}
stars();
// setInterval(clickButton, 1000);
// let api = `https://pro.openweathermap.org/data/2.5/forecast/climate?q=${inputValue},in&appid=b5f558462160da78810acd0bb997a9fd`;
form.submit(function (e) {
  txt.show();
  loader.show();
  e.preventDefault();
  // PLEASE USE YOUR OWN APPID!
  fetch(
    `https://api.openweathermap.org/data/2.5/weather?q=${inputValue.val()}&appid=b5f558462160da78810acd0bb997a9fd`
  )
    .then((response) => response.json())
    .then((data) => {
      clickButton();
      console.log(data);
      txt.hide();
      loader.hide();
      inputValue.val("");
      let max = Math.ceil(data.main.temp_min - 273.15);
      let min = Math.floor(data.main.temp_min - 273.15);
      let temp = Math.floor(data.main.temp - 273.15);
      let desc = data.weather[0].main;
      let name = data.name;
      let country = data.sys.country;
      let feel = Math.floor(data.main.feels_like - 273.15);
      let humidity = data.main.humidity;
      let pressure = data.main.pressure;
      let wind = data.wind.speed;
      let direction = data.wind.deg;
      let img = data.weather[0].icon;
      Img.attr("src", `icons/${img}.png`);
      let dir = getDirection(direction);
      Direction.html(dir);

      More.show();
      Wind.html(wind);
      Feel.html(feel);
      Humid.html(humidity);
      Pressure.html(pressure);
      Name.html(name);
      Temp.html(temp + " <sup>°C</sup> ");
      Descriprion.show();
      Marker.show();
      Slash.show();
      Max.html(max + "°C");
      Min.html(min + "°C");
      Country.html(country);
      Desc.html(desc);
      Day.html(day);
    })
    .catch((err) => {
      let error = $("#err");
      error.html("No match found.");
      $("#popup-wrapper").addClass("show");
    });
});

$(document).ready(function () {
  let long;
  let lat;
  if (navigator.geolocation) {
    var storedValues = window.localStorage.long;
    if (!storedValues) {
      navigator.geolocation.getCurrentPosition((position) => {
        long = position.coords.longitude;
        lat = position.coords.latitude;
        window.localStorage.lat = lat;
        window.localStorage.long = long;

        const api = `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${long}&appid=b5f558462160da78810acd0bb997a9fd`;

        fetch(api)
          .then((response) => {
            return response.json();
          })
          .then((data) => {
            console.log(data);
            loader.hide();
            txt.hide();

            let max = Math.ceil(data.main.temp_min - 273.15);
            let min = Math.floor(data.main.temp_min - 273.15);
            let temp = Math.floor(data.main.temp - 273.15);
            let desc = data.weather[0].main;
            let name = data.name;
            let country = data.sys.country;
            let feel = Math.floor(data.main.feels_like - 273.15);
            let humidity = data.main.humidity;
            let pressure = data.main.pressure;
            let wind = data.wind.speed;
            let img = data.weather[0].icon;
            Img.attr("src", `icons/${img}.png`);
            More.show();
            let direction = data.wind.deg;

            let dir = getDirection(direction);
            Direction.html(dir);
            Wind.html(wind);
            Feel.html(feel);
            Humid.html(humidity);
            Pressure.html(pressure);
            Name.html(name);
            Temp.html(temp + " <sup>°C</sup> ");
            Descriprion.show();
            Marker.show();
            Slash.show();
            Max.html(max + "°C");
            Min.html(min + "°C");
            Country.html(country);
            Desc.html(desc);
            Day.html(day);
          });
        // fetch(
        //   `https://api.openweathermap.org/data/2.5/forecast?lat=${lat}&lon=${long}&appid=b5f558462160da78810acd0bb997a9fd`
        // )
        //   .then((response) => response.json())
        //   .then((data) => {
        //     console.log(data);
        //     inputValue.val("");
        //   })
        //   .catch((err) => alert("Wrong"));
      });
    } else {
      let long = window.localStorage.long;
      let lat = window.localStorage.lat;
      const api = `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${long}&appid=b5f558462160da78810acd0bb997a9fd`;

      fetch(api)
        .then((response) => {
          return response.json();
        })
        .then((data) => {
          console.log(data);
          loader.hide();
          txt.hide();
          let max = Math.ceil(data.main.temp_min - 273.15);
          let min = Math.floor(data.main.temp_min - 273.15);
          let temp = Math.floor(data.main.temp - 273.15);
          let desc = data.weather[0].main;
          let name = data.name;
          let country = data.sys.country;
          let img = data.weather[0].icon;
          Img.attr("src", `icons/${img}.png`);
          let feel = Math.floor(data.main.feels_like - 273.15);
          let humidity = data.main.humidity;
          let pressure = data.main.pressure;
          let wind = data.wind.speed;
          More.show();
          let direction = data.wind.deg;

          let dir = getDirection(direction);
          Direction.html(dir);
          Wind.html(wind);
          Feel.html(feel);
          Humid.html(humidity);
          Pressure.html(pressure);
          Name.html(name);
          Temp.html(temp + " <sup>°C</sup> ");
          Descriprion.show();
          Marker.show();
          Slash.show();
          Max.html(max + "°C");
          Min.html(min + "°C");
          Country.html(country);
          Desc.html(desc);
          Day.html(day);
        });
    }
  } else {
    alert("Please allow access to your location.");
  }
});

              
            
!
999px

Console