커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
2주차 숙제
[GPT] 웹개발 종합반 v0
2주차
북마크
댓글
3
추천
0
조회수
7
조회수
7
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.




feach 아이콘 부분을 구현해봤는데 뭐가 잘못됐는지 바뀌지가 않습니당 ㅠㅠ

스파르타 즉문즉답


<!DOCTYPE html>
<html lang="ko">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body {
        background-image: url("https://s3.ap-northeast-2.amazonaws.com/materials.spartacodingclub.kr/webjong/images/background.jpg");
        background-position: center;
        background-size: cover;
        color: white;
      }


      .navbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
      }


      .weather {
        display: flex;
        align-items: center;
        margin-right: 30px;
      }


      .container {
        display: flex;
        flex-direction: column;
        /* Flex 안의 아이템들을 세로 방향으로 배치합니다. */
        justify-content: center;
        /* 주축 방향으로 가운데 정렬합니다. */
        align-items: center;
        /* 교차축 방향으로 가운데 정렬합니다. */
        height: 100vh;
        text-align: center;
      }


      .footer {
        position: fixed;
        left: 0;
        bottom: 0;
        width: 100%;
        text-align: center;
        font-weight: bold;
        padding: 20px 0;
      }


      .greeting {
        margin-bottom: 50px;
      }


      .motto {
        margin-bottom: 100px;
      }


      .logo {
        height: 32px;
        margin-left: 30px;
      }
    </style>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
  </head>


  <body>
    <nav class="navbar">
      <img
        class="logo"
        src="https://s3.ap-northeast-2.amazonaws.com/materials.spartacodingclub.kr/webjong/images/sparta-logo.svg"
        alt=""
      />
      <div class="weather">
        <img
          id="imageIcon"
          src="https://ssl.gstatic.com/onebox/weather/64/partly_cloudy.png"
        />
        <p id="weather_weather">날씨 맑음, 20ºC</p>
      </div>
    </nav>


    <div class="container">
      <div class="greeting">
        <h1>Hello, My name!</h1>
        <h1 id="current-time">12:30</h1>
      </div>


      <div class="motto">
        <h3>My life's motto</h3>
        <h2>웃으면 행복해집니다.</h2>
      </div>
    </div>


    <div class="footer">
      <p id="quoteAuthor">- 작자 미상 -</p>
      <p id="quoteContent">멋진 명언입니다. 아이스크림을 먹으면 행복해져요.</p>
    </div>


    <script>
      function displayCurrentTime() {
        let currentTime = new Date();
        let hours = currentTime.getHours();
        let minutes = currentTime.getMinutes();
        let seconds = currentTime.getSeconds();


        let meridiem = hours >= 12 ? "PM" : "AM";


        hours = hours > 12 ? hours - 12 : hours;


        hours = addLeadingZero(hours);
        minutes = addLeadingZero(minutes);
        seconds = addLeadingZero(seconds);


        let timeString = hours + ":" + minutes + ":" + seconds + " " + meridiem;
        document.getElementById("current-time").innerHTML = timeString;
      }


      function addLeadingZero(number) {
        return number < 10 ? "0" + number : number;
      }


      setInterval(displayCurrentTime, 1000);


      let url = "https://api.quotable.io/random";
      fetch(url)
        .then((res) => res.json())
        .then((data) => {
          console.log(data);
          let author = data["author"];
          let content = data["content"];


          let authorMsg = `${author} -`;
          let contentMsg = `"${content}"`;


          $("#quoteAuthor").text(authorMsg);
          $("#quoteContent").text(contentMsg);
        });


      let weather_url = "http://spartacodingclub.shop/sparta_api/weather/seoul";
      fetch(weather_url)
        .then((res) => res.json())
        .then((data) => {
          console.log(data);
          let temp = data["temp"];
          let icon_url = data[icon];
          let message = `${temp}ºC`;


          $("#imageIcon").text(icon_url);
          $("#weather_weather").text(message);
        });
    </script>
  </body>
</html>










취소
 공유
취소
댓글 0
댓글 알림
나의얼굴