Code
Created by: Niranjan Reddy
Tags: Calendar and events
After receiving a minimum of 25 recommendations, an entry earns the "Community Approved" badge.
Please keep in mind, all entries are community created and may not be fully supported by HubSpot.
View on:
<div class="text-center countDown">
<div class="">
<span class='countDate' src='{{ module.countdown_date|datetimeformat('%Y/%m/%d') }}'></span>
<div class="dateCount noListStyle">
<ul>
<li class='ib'><span id="days"></span> days</li>
<li class='ib'><span id="hours"></span> Hours</li>
<li class='ib'><span id="minutes"></span> Minutes</li>
<li class='ib'><span id="seconds"></span> Seconds</li>
</ul>
</div>
</div>
</div>
.cards {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.card {
flex: 0 1 320px;
display: flex;
margin: 1rem 0;
}
.card__image {
flex: 0 0 30px;
}
.card__text {
flex: 1 1 100%;
padding: 0 1rem;
}
.card__text h4 {
margin-top: 0;
margin-bottom: 0.5rem;
}
.card:after {
content: '';
flex: auto;
}
// js
var date = $('.countDate').attr('src');
const second = 1000,
minute = second * 60,
hour = minute * 60,
day = hour * 24;
let countDown = new Date(date).getTime(),
x = setInterval(function() {
let now = new Date().getTime(),
distance = countDown - now;
document.getElementById('days').innerText = Math.floor(distance / (day)),
document.getElementById('hours').innerText = Math.floor((distance % (day)) / (hour)),
document.getElementById('minutes').innerText = Math.floor((distance % (hour)) / (minute)),
document.getElementById('seconds').innerText = Math.floor((distance % (minute)) / second); }, second)
This module is for showcasing upcoming event timer. This module is meant to be used with a Coded HubSpot Template. The following resources were used: 1.Custom Modules
A demo of this in action can be seen on https://preview.hs-sites.com/hcms/preview/template/multi?isbufferedtemplatelayout=true&portalId=2474026&tcdeviceCategory=undefined&templatelayout_id=13430734727&updated=1568621668416
After coding your custom template, your best use with this module inside of pre-defined Flexible Column area. An example of this is below:
Once you have this code in your custom module with some javascript for it given below:
// js
var date = $('.countDate').attr('src'); const second = 1000, minute = second * 60, hour = minute * 60, day = hour * 24; let countDown = new Date(date).getTime(), x = setInterval(function() { let now = new Date().getTime(), distance = countDown - now; document.getElementById('days').innerText = Math.floor(distance / (day)), document.getElementById('hours').innerText = Math.floor((distance % (day)) / (hour)), document.getElementById('minutes').innerText = Math.floor((distance % (hour)) / (minute)), document.getElementById('seconds').innerText = Math.floor((distance % (minute)) / second); }, second)
You can use this module and place it at any point of your page design …. checkout the below link to know how to create custom modules https://knowledge.hubspot.com/articles/kcs_article/cos-general/create-and-edit-modules for example
Below link is a vedio where this shows how to work with this module: https://drive.google.com/open?id=1gh9yrkmwRl99mBE3LV1hqp44LXkteQu https://drive.google.com/open?id=1o36lfj1RF-CGYRR3OVNDCYOQWnBlE4A8 https://drive.google.com/open?id=1upLMZdsYr4KgxXEOQVPbb1ICdLBMc0n
https://www.loom.com/share/0fc08026b64f4f46aa0e10351d15e591
A modern framework for accelerating build times on the HubSpot CMS. Based on a modified Bootstrap 4 framework.
Lead developers: Jon McLaren
Chrome/Chromium extension for HubSpot CMS Developers that adds a developer menu, dark theme and useful shortcuts to commonly used HubSpot query parameters, resources, and tools for making HubSpot Development easier and more enjoyable.
Lead developers: Jon McLaren , William Spiro , Gonzalo Torreras
This extension enables super fast local development of CMS pages, and is a great compliment to using the new local HubL server. It contains comprehensive HubL tag, function, filter and expression test auto-complete snippets, as well as their documentation.
Lead developers: William Spiro
Find an entry with an issue, bug, or abuse?
Please complete the below information in detail and we will investigate.
Reporting as Luke Summerfield