Answer the question
In order to leave comments, you need to log in
How to make a preloader in Bitrix that starts only on the first visit to the page?
Tell me how to make a preloader in Bitrix, which starts only on the first visit to the page.
I wrote a simple JS code, while the page is loading, the preloader is visible, on the window.onload event (when the entire html has loaded in the browser), JS adds a style to the preloader that hides it.
.loaded {
display: none;
}
window.onload = function () {
const preloader = document.querySelector('.preloader');
preloader.classList.add('loaded');
}
Answer the question
In order to leave comments, you need to log in
You need to add to the site template a check for the set cookie that is set after the first display and, depending on it, add your code to <head>
or not. To do this, you will need the following methods:
https://dev.1c-bitrix.ru/api_d7/bitrix/main/page/a...
https://dev.1c-bitrix.ru/api_d7/bitrix/main/httpre. ..
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question