Code

Play Interaction after X Clicks

Play a Webflow interaction after clicking on an element X number of times on your Webflow site. A unique way to create unique interactions that are based on the number of times an element is clicked.

Play Interaction after X Clicks preview

Play a Webflow interaction after clicking on an element X number of times on your Webflow site. A unique way to create unique interactions that are based on the number of times an element is clicked.

How to add it

  1. Add the Javascript code to the closing body custom code section
  2. Update 15 with the number of clicks and update the class names

The code

Javascript
                      <!-- Add to body close section -->
<script>

// Replace 15 with your desired number of clicks

let stickerCount = 0;
$('.class-of-items-user-will-click').on("click", function() {
  $(this).off("click");
  stickerCount++;
  //Check if all stickers have been clicked
  if(stickerCount == 15){
    $('.class-of-item-with-click-interaction').click();
  }
});

</script>

                    

Browse similar code snippets

Categories

Language

More from Timothy Ricks

Profile →

Related Webflow questions

All answers →

Similar code snippets

All code snippets →