Are you putting together your VSL sales page and want to show just the video for a few minutes? Want to hide the buy button or some page element for a while? In this article we will present a simple solution.
It's incredible how difficult it is to find something so simple on the internet, perhaps due to lack of expressing the correct term. Sometimes we come across plugins or huge codes to accomplish something very simple.
What we want here is to hide a CSS element, and only display it after a period of time. This can easily be created with a simple Javascript of less than 4 lines.
How to hide an element for a few minutes?
The first thing you need to understand is which element you are going to hide. If you want to hide almost the entire page, leaving only the video, just create a DIV with HTML, put a CSS class of your choice, and close it at the bottom of the page.
.classname {display:none;}
If you're using the WordPress block editor, you can also easily hide elements by going to each block's advanced settings and setting the CSS class.
After choosing the CSS class and adding it to the elements you want to hide, you need to add the Javascript in the Header. This all depends on the theme or plugin you are using.
Add the following code in the Header:
<script>setTimeout(function() {
$('.classname').show()
}, 400000);
</script>
In ClassName, you put the name of the class you want to hide. In the number 400000 you determine the waiting time for the element to become visible. It's about milliseconds.
Every 1000, we have a total of 1 second. So the 400000 found in the code equals about 6 minutes. You can use this information to calculate your desired time.
See how simple it is to hide an element or half of the page for a period? A simple code, perfect for creating your VSL, sales page or anything else you want to focus on.