Интерактивная страница регистрации с всплывающими окнами - PullRequest
0 голосов
/ 15 июня 2019

Итак, я пытаюсь работать на платформе для моей церкви. По сути, когда молодежь приходит в наш новый медиацентр, мы хотим:

  1. молодежь нажимает на одну из предоставленных эмоций в зависимости от своих ощущений
  2. всплывающее отрывок из Священного Писания, связанный с выбранной ими эмоцией

Я новичок в кодировании (занимался этим всего несколько недель вне работы), и я ошеломлен тем, где я ошибся.

Изначально я использовал функцию наведения, но теперь я хочу перейти на всплывающее окно, как указано в пуле 2.

Вот мой кодовый блок: https://codepen.io/mj2913/pen/pXgxOz

    <div class="happy-thumb popup" onclick="myFunction()">
        <p>happy
          <span class="popup-thumb-span" id="happyPopup">I praise you, for I am fearfully and wonderfully made. Wonderful are your works; my soul knows it very well. Psalm 139:14</span>
        </p>
      </div>
    <script>
    function myFunction() {
      var popup = document.getElementById("happyPopup");
      popup.classList.toggle("show");
    }
    </script>

1 Ответ

0 голосов
/ 15 июня 2019

Попробуй это. Я добавил модальное всплывающее окно jQuery. Замените свою HTML-страницу ниже

  <!DOCTYPE html>
    <html lang="en">
    <link href="https://fonts.googleapis.com/css?family=Raleway&display=swap" rel="stylesheet">
    <!-- Remember to include jQuery :) -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>

    <!-- jQuery Modal -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css" />
    <head>
      <h1>Welcome to Friendship Community Church's Youth Media Center</h1>
      <h2>How Are You Feeling Today?</h2>
    </head>

    <div class="col1">
      <button class="happy-thumb popup" onclick="$('#happyPopup').modal();">
        <p>happy
          <span class="popup-thumb-span" id="happyPopup" rel:"modal:open">I praise you, for I am fearfully and wonderfully made. Wonderful are your works; my soul knows it very well. Psalm 139:14</>
        </p>
      </div>
      <div class="sad-thumb popup">
        <p>sad
          <span class="popup-thumb-span" id="sadPopup">Therefore confess your sins to each other and pray for each other so that you may be healed. The prayer of a righteous man is powerful and effective. James 5:16</span>
        </p>
      </div>
      <div class="surprised-thumb popup">
        <p>surprised
          <span class="popup-thumb-span" id="surprisedPopup">Trust in the Lord with all your heart and lean not on your own understanding; in all your ways submit to Him, and He will make your paths straight. Proverbs 3:5-6</span>
        </p>
      </div>
      <div class="anxious-thumb popup">
        <p>anxious
          <span class="popup-thumb-span" id="anxiousPopup">Do not be anxious about anything, but in everything, by prayer and petition, with thanksgiving, present your requests to God. Phillipians 4:6</span>
        </p>
      </div>
    </div>
    <div class="col2">
      <div class="fearful-thumb popup">
        <p>fearful
          <span class="popup-thumb-span" id="fearfulPopup">Surely God is my salvation; I will trust and not be afraid. The LORD himself is my strength and my defense; he has become my salvation. Isaiah 12:2</span>
        </p>
      </div>
      <div class="confident-thumb popup">
        <p>confident
          <span class="popup-thumb-span" id="confidentPopup">I have told you these things, so that in me you may have peace. In this world you will have trouble. But take heart! I have overcome the world. John 16:33</span>
        </p>
      </div>
      <div class="tired-thumb popup">
        <p>tired
          <span class="popup-thumb-span" id="tiredPopup">Come to me, all you who are weary and burdened, and I will give you rest. Matthew 11:28</span>
        </p>
      </div>
      <div class="joyful-thumb popup">
        <p>joyful
          <span class="popup-thumb-span" id="joyfulPopup">Sing for joy, O heavens, and exult, O earth; break forth, O mountains, into singing! For the Lord has comforted his people and will have compassion on his afflicted. Isaiah 49:13</span>
        </p>
      </div>
    </div>
    <div class="col3">
      <div class="discouraged-thumb popup">
        <p>discouraged
          <span class="popup-thumb-span" id="discouragedPopup">Have I not commanded you? Be strong and courageous. Do not be afraid; do not be discouraged, for the Lord your God will be with you wherever you go. Joshua 1:9</span>
        </p>
      </div>
      <div class="pitiful-thumb popup">
        <p>pitiful
          <span class="popup-thumb-span" id="pitifulPopup">Humble yourselves, therefore, under God’s mighty hand, that He may lift you up in due time. Cast all your anxiety on Him because He cares for you. 1 Peter 5:6-7</span>
        </p>
      </div>
      <div class="impatient-thumb popup">
        <p>impatient
          <span class="popup-thumb-span" id="impatientPopup">Jesus said, I am the way, the truth, and the life. No one comes to the Father except through Me. John 14:6</span>
        </p>
      </div>
      <div class="cautious-thumb popup">
        <p>cautious
          <span class="popup-thumb-span" id="cautiousPopup">'For I know the plans I have for you', declares the LORD, 'plans to prosper you and not to harm you, plans to give you hope and a future'. Jeremiah 29:11</span>
        </p>
      </div>
    </div>
    <div class="col4">
      <div class="unloved-thumb popup">
        <p>unloved
          <span class="popup-thumb-span" id="unlovedPopup">Love is patient, love is kind. It does not envy, it does not boast, it is not proud. 1 Corinthians 13:4</span>
        </p>
      </div>
      <div class="hopeless-thumb popup">
        <p>hopeless
          <span class="popup-thumb-span" id="hopelessPopup">Jesus said to him, 'I am the way, and the truth, and the life. No one comes to the Father except through me'. John 14:6</span>
        </p>
      </div>
      <div class="confused-thumb popup">
        <p>confused
          <span class="popup-thumb-span" id="confusedPopup">Be on your guard; stand firm in faith; be courageous; be strong. 1 Corinthians 16:13</span>
        </p>
      </div>
      <div class="stressed-thumb popup">
        <p>stressed
          <span class="popup-thumb-span" id="stressedPopup">So do not fear, for I am with you; do not be dismayed, for I am your God. I will strengthen you and help you; I will uphold you with my righteous right hand. Isaiah 41:10</span>
        </p>
      </div>
    </div>
    </div>
    </div>
    <p>Code inspired by MIT. All rights reserved to them</p>

Выход enter image description here

Библиотека jQuery - https://jquerymodal.com/

...