A timer that allows for quick implementation in your everyday projects. Developed for in-house use at Banyan Hill Publishing, LLC. This program was written using the JavaScript OOP pattern. Basic knowledge of this pattern is a recommended, but not required.
Usage
To use this timer on your site, you must insert the element and scripts into your document. Then, adjust the
timer.settings
object properties to your specifications.You may set HTML to the
displayHeading
,expiredMessage
, andredirectText
properties.Be sure to include
https://
in your redirect url.⚠️ The
autoRedirect
property:
If you set the
autoRedirect
property totrue
, then you must also include theredirectLink
property.Setting this property to
false
allows for you to omit theredirectLink
property.Example object when
autoRedirect
is set totrue
:
timer.settings({ timerType: "deadline", deadlineDate: "2022-10-01T09:00:00", displayHeading: "Your Offer <span class='nobr'>Ends In:</span>", expiredMessage: "<h2>Offer Expired</h2> <h2 class='h4'>We're sorry you <span class='nobr'>missed it!</span></h2>", redirectText: "Let\'s Get Started!", redirectLink: "https://www.banyanhill.com", autoRedirect: true, showDays: true, showHours: true });See the full timer setup documentation below.
The timer stylesheet will be added to your document head dynamically.
Implementation
First, insert the element and scripts into your document. You may place them anywhere within the opening and closing
body
tags.Element:
<div id='deadlineTimer'></div>Scripts:
<script src="https://cloudcollective.s3.amazonaws.com/scripts/assets/countdownTimer/countdownTimer.js.gz"></script> <script type="text/javascript"></script>To initilize the Deadline Timer, you must set the
timerType
property to"deadline"
Next, you must include and define the following property values on your timer object:
deadlineDate
expiredMessage
autoRedirect
showDays
showHours
The following properties and are set to
"true"
by defualt. You may change them to"false"
if you want to hide them:
showDays
showHours
You may choose to define the following property values on your timer, as they are optional:
displayHeading
redirectText
redirectLink
⚠️ If you set the
autoRedirect
property totrue
, then you must also include theredirectLink
property.When the
autoRedirect
property is set totrue
and theredirectText
is an empty string, the default hyperlinked text will sayYou will be automatically redirected...
When the
autoRedirect
property is set tofalse
and theredirectText
is an empty string, the default hyperlinked text will sayLearn about our other services.
The
redirectLink
property default setting is hyperlinked to the Banyan Hill website.
Implementation
First, insert the element and scripts into your document. You may place them anywhere within the opening and closing
body
tags.Element:
<div id='deadlineTimer'></div>Script:
<script src="https://cloudcollective.s3.amazonaws.com/scripts/assets/countdownTimer/countdownTimer.js.gz"></script> <script type="text/javascript"></script>To initilize the Minutes Timer, you must set the
timerType
property to"minutes"
. Next, you must include and define the following property values on your timer object:
expiredMessage
autoRedirect
minutesLeft
secondsLeft
You may choose to define the following property values on your timer, as they are optional:
displayHeading
redirectText
redirectLink
⚠️ If you set the
autoRedirect
property totrue
, then you must also include theredirectLink
property.When the
autoRedirect
property is set totrue
and theredirectText
is an empty string, the default hyperlinked text will sayYou will be automatically redirected...
When the
autoRedirect
property is set tofalse
and theredirectText
is an empty string, the default hyperlinked text will sayLearn about our other services.
The
redirectLink
property default setting is hyperlinked to the Banyan Hill website.
timerType: "deadline"
).displayHeading
property.expiredMessage
property.redirectLink
property (omitting this will automatically redirect to the Banyan Hill website).showDays: false
and/or showHours: false
properties.minutesLeft
and secondsLeft
properties to specific number values.You should refer to the browser console to review errors and warnings if the timer does not behave as expected (Shift + Ctrl + K
on Windows and Command + Option + J
on Mac;
You can also right click on the broswer's page and use the menu to inspect the page).
debugging master
)Contributions are always welcomed!
If you'd like to contribute to this project, please email me at ataylor.banyanhill@gmail.com.
Please put "Countdown Timer: Banyan Hill" in the subject line, then briefly share what you'd like to contribute to this project and how you think it could be implemented.
Copyright @