- Is there a way to schedule elements on the page to turn the visibility on & off on specific dates?
- Are the sites hosted on a cloud or dedicated server? I would assume dedicated, but want to answer for a client.
Hey,
Sorry for later answer, we must have missed this question.
- Currently, the only way to accomplish this is by creating custom JavaScript. For instance, you could create a class named ‘newyear-banner’ and assign it to an element that you wish to display only on December 31st. Set the default state to ‘display: none’. Then, use JavaScript to check the current date, and reveal the element if the date is correct. I quicky used example below to create code below with Chat GPT. So something like this one below should work.
// Check the current date
var currentDate = new Date();
var month = currentDate.getMonth() + 1; // getMonth() returns month from 0-11
var day = currentDate.getDate();
// Check if it's December 31st
if (month === 12 && day === 31) {
// If it's December 31st, display the element with the 'newyear-banner' class
$('.newyear-banner').css('display', 'block');
}
- It’s cloud, and we are utilizing a CDN for everything along with Anycast IP, ensuring your website operates extremely fast worldwide. For assets (images, videos, files), we are using BunnyCDN
Thank you for the reply, better late than never
Your scheduling solution could potentially work for now, however for collaborator’s this process might be more difficult. Do you think since it’s such a simple solution with javascript, that it is a feature that we might could expect in the future. I’d love to be able to select a date for it to show or hide by right clicking on the element in the left hand menu, a simple interface that worked with your shared script would be absolutely amazing.
For example:
I can create a plugin that would work in front-end, using similar code that I wrote above, just adding range option, so you can choose multiple days. In that way, you would visually choose dates, and I would run JS without you needing to touch it. Would that work?