title: Why does the animation not work if I change pages?
body: <p>I have a Drupal 8 site with Bootstrap 3 theme.</p>
  
  <p>I created a homepage with a newsfeed. Whenever there is a publication on the site, it generates a message in the newsfeed. The messages can have the status read or unread.</p>
  
  <p>I want that when the <code>.action-flag</code> class is in the page, an animation is applied on the logo of the site.</p>
  
  <p>The CSS and JS file is included on all pages of the site.</p>
  
  <p>The <code>.action-flag</code> class is only on the home page, when a message is not marked as read.</p>
  
  <p>Here is the structure of my homepage :</p>
  
  <p><a href="https://i.stack.imgur.com/e9dgg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/e9dgg.png" alt="enter image description here"></a></p>
  
  <p>Here is my JS code :</p>
  
  <pre><code>  if ($("#pills-private .action-flag").length) {
      $(".region-navigation-logo img").addClass("timeline-notification");
    };
  </code></pre>
  
  <p>Here is my CSS code :</p>
  
  <pre><code>@keyframes pulse {
      0% {
          box-shadow: 0 0 0 0 rgba(138, 186, 18, 1);
      }
      70% {
          box-shadow: 0 0 0 10px rgba(138, 186, 18, 0);
      }
      100% {
          box-shadow: 0 0 0 0 rgba(138, 186, 18, 0);
      }
  }
  
  .region-navigation-logo img {
      height: 56px;
      border-radius: 50%;
      background: #8aba12;
  }
  
  .timeline-notification {
      box-shadow: 0 0 0 rgba(138, 186, 18, 1);
      animation: pulse 2s infinite;
  }
  </code></pre>
  
  <p>Currently, the animation works very well. But only if I'm on the homepage. If I go to another page, the animation does not work anymore.</p>
  
  <p><strong>THE PROBLEM</strong></p>
  
  <p>It only works when I go to the homepage. I want it to work on the whole site. The goal is to notify the user that a new activity is available in their newsfeed.</p>
  
  <p>Is there a solution for this?</p>