Run animation once per session

My bad, sry. The problem was that the js-code got executed before the interaction and so the data was always set in the session-storage and the interaction-condition always false.

Try the following instead:

<script>
  
  var counter = sessionStorage.getItem('page_loaded_counter');
  if (counter === null) {
    counter = 0;
  } else {
    counter = parseInt(counter); 
  }
  
  counter++; 
  
  sessionStorage.setItem('page_loaded_counter', counter); 
</script>

1 Like