0
votes

Appliquez la classe de manière aléatoire sur les éléments de la liste toutes les 5 secondes

J'ai une liste d'éléments dans lesquels j'ai une animation .. Dans cela, je dois modifier les articles de la liste de la liste dans une base circulaire pour toutes les 5 secondes.

J'ai 5 articles de liste, au 1er aucun d'entre eux aura la classe. Une fois que les classes ouvertes de la page doivent leur être attribuées comme "Card0", "Card1", "Card2", "Card3", "Card4" respectivement .. Et puis toutes les 5 secondes, il doit être interchangé en circulaire p>

p>

<div class="changelog">

    <ul class="entries">
        <li class="card0" style="transform: translateY(122px) scale(1.07);">
            <p class="meta">
                <strong>Connect</strong>
                <span>August 1</span>
            </p>
            <p>Platforms can now export connected account information as a CSV from the Dashboard.</p>
        </li>
        <li class="card1" style="transform: translateY(152px) scale(1);">
            <p class="meta">
                <strong>Terminal</strong>
                <span>July 30</span>
            </p>
            <p>You can now use WiFi to connect a P400 card reader to your point of sale application.</p>
        </li>
        <li class="card2" style="transform: translateY(182px) scale(0.934579);">
            <p class="meta">
                <strong>Connect</strong>
                <span>July 29</span>
            </p>
            <p>Express accounts now support 5 new languages (German, Italian, Japanese, Spanish, and Simplified Chinese) for the onboarding flow, dashboard, emails, and text messages.</p>
        </li>
        <li class="card3" style="transform: translateY(212px) scale(0.873439);">
            <p class="meta">
                <strong>Radar</strong>
                <span>July 22</span>
            </p>
            <p>Set rules with the new <code>is_off_session</code> attribute, which detects if a customer was charged anytime after they initially completed the checkout&nbsp;flow.</p>
        </li>
        <li class="card4" style="transform: translateY(272px) scale(0.816298);">
            <p class="meta">
                <strong>Mobile</strong>
                <span>July 19</span>
            </p>
            <p>Our updated mobile SDKs now support in-app 3D Secure 2 authentication, letting you customize the appearance of the authentication&nbsp;UI.</p>
        </li>
    </ul>
</div>


5 commentaires

Avez-vous encore essayé quelque chose?


Utilisez seinterval et math.random .


Non, je n'ai rien essayé ... J'ai pris ce code d'un autre site web .. Le script ne fonctionne pas .. Mais j'ai constaté qu'ils changent de classe de changement de manière aléatoire, d'autres animations se chargent de CSS ..


Mate, ce n'est pas un service de codage. Essayez de votre fin et tirez sur les problèmes ici s'il vous plaît!


@Nidhinjoseph: Quelqu'un sera intéressé de m'aider .. alors merci ..


3 Réponses :


2
votes

Vous devez utiliser seinterval code> vérifier l'extrait.

p>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="changelog">

  <ul class="entries">
    <li class="card0" style="transform: translateY(122px) scale(1.07);">
      <p class="meta">
        <strong>Connect</strong>
        <span>August  1</span>
      </p>
      <p>Platforms can now export connected account information as a CSV from the Dashboard.</p>
    </li>
    <li class="card1" style="transform: translateY(152px) scale(1);">
      <p class="meta">
        <strong>Terminal</strong>
        <span>July 30</span>
      </p>
      <p>You can now use WiFi to connect a P400 card reader to your point of sale application.</p>
    </li>
    <li class="card2" style="transform: translateY(182px) scale(0.934579);">
      <p class="meta">
        <strong>Connect</strong>
        <span>July 29</span>
      </p>
      <p>Express accounts now support 5 new languages (German, Italian, Japanese, Spanish, and Simplified Chinese) for the onboarding flow, dashboard, emails, and text messages.</p>
    </li>
    <li class="card3" style="transform: translateY(212px) scale(0.873439);">
      <p class="meta">
        <strong>Radar</strong>
        <span>July 22</span>
      </p>
      <p>Set rules with the new <code>is_off_session</code> attribute, which detects if a customer was charged anytime after they initially completed the checkout&nbsp;flow.</p>
    </li>
    <li class="card4" style="transform: translateY(272px) scale(0.816298);">
      <p class="meta">
        <strong>Mobile</strong>
        <span>July 19</span>
      </p>
      <p>Our updated mobile SDKs now support in-app 3D Secure 2 authentication, letting you customize the appearance of the authentication&nbsp;UI.</p>
    </li>
  </ul>
</div>


2 commentaires

Non, ce n'est pas interchangeant la classe ... Ce code est juste de continuer à ajouter la classe


  • J'aime celui-ci son ajout



  • 1
    votes

    Cette fonction fera pivoter les classes via chaque élément li code> qui a une catégorie code> code>. Il obtient la classe actuelle, incrémente le nombre (MODULO 5), puis l'applique à l'élément.

    p>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <div class="changelog">
    
      <ul class="entries">
        <li class="card0">
          <p class="meta">
            <strong>Connect</strong>
            <span>August  1</span>
          </p>
        </li>
        <li class="card1">
          <p class="meta">
            <strong>Terminal</strong>
            <span>July 30</span>
          </p>
        </li>
        <li class="card2">
          <p class="meta">
            <strong>Connect</strong>
            <span>July 29</span>
          </p>
        </li>
        <li class="card3">
          <p class="meta">
            <strong>Radar</strong>
            <span>July 22</span>
          </p>
        </li>
        <li class="card4">
          <p class="meta">
            <strong>Mobile</strong>
            <span>July 19</span>
          </p>
        </li>
      </ul>
    </div>


    1 commentaires

    @Mohanarangan aucun souci. Je suis heureux d'avoir pu aider.



    1
    votes

    Vous pouvez parcourir tous les éléments li code> et incrémenter leur classe.

    Essayez le snippet ci-dessous: p>

    p>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    
    <div class="changelog">
      <ul class="entries">
        <li class="card0" style="transform: translateY(122px) scale(1.07);">
          <p class="meta">
            <strong>Connect</strong>
            <span>August  1</span>
          </p>
          <p>Platforms can now export connected account information as a CSV from the Dashboard.</p>
        </li>
        <li class="card1" style="transform: translateY(152px) scale(1);">
          <p class="meta">
            <strong>Terminal</strong>
            <span>July 30</span>
          </p>
          <p>You can now use WiFi to connect a P400 card reader to your point of sale application.</p>
        </li>
        <li class="card2" style="transform: translateY(182px) scale(0.934579);">
          <p class="meta">
            <strong>Connect</strong>
            <span>July 29</span>
          </p>
          <p>Express accounts now support 5 new languages (German, Italian, Japanese, Spanish, and Simplified Chinese) for the onboarding flow, dashboard, emails, and text messages.</p>
        </li>
        <li class="card3" style="transform: translateY(212px) scale(0.873439);">
          <p class="meta">
            <strong>Radar</strong>
            <span>July 22</span>
          </p>
          <p>Set rules with the new <code>is_off_session</code> attribute, which detects if a customer was charged anytime after they initially completed the checkout&nbsp;flow.</p>
        </li>
        <li class="card4" style="transform: translateY(272px) scale(0.816298);">
          <p class="meta">
            <strong>Mobile</strong>
            <span>July 19</span>
          </p>
          <p>Our updated mobile SDKs now support in-app 3D Secure 2 authentication, letting you customize the appearance of the authentication&nbsp;UI.</p>
        </li>
      </ul>
    </div>


    0 commentaires