Thursday, December 14, 2017

Christmas Pop-up with Countdown Timer and Falling Snow For Websites

Christmas Pop-up with Countdown Timer and Falling Snow For Websites

Link to My Blogger Tricks

Christmas Pop-up with Countdown Timer and Falling Snow For Websites

Posted: 13 Dec 2017 01:27 PM PST

jQuery Christmas pop-up for websitesWelcome your website visitors with falling snow and a count down timer this Christmas 2017. An easy to add jQuery pop-up for Christmas greetings that can be added to any simple webpage, WordPress blog or Blogger blog.

To keep our tradition alive, we are releasing our premium set of jQuery Pop-ups as Holiday gift to all MBT readers. This Popup plugin is specially designed and developed with Five Unique Features! It is completely customizable, has a countdown timer that can be set to any date and time, has 3 different animations, 2 attractive Christmas Background themes and most importantly it is the first popup plugin of its kind introduced for blogger blogs that comes with HTML5 sessionStorage functionality to set cookie in order to control the popup display. You can decide whether to show the popup only once to your visitors or on every new visit. It is perfectly compatible with all major browsers. Interesting part of it is that the scripts are stored on our servers so no headache  on your part thus making the installation extremely easy. You can add it easily to your blogger blog or Wordpress blog or on any webpage you may have. Lets view a Live demo first on Blogger and then on two simple webpages.

Blogger: LIVE DEMO - fadeAndPop 

Simple Webpage: DEMO 1 - fade  DEMO 2 - none

Note: The above demos show each animation style. In order to check whether cookies are stored or not, simply refresh the page and you will find that the popup doesn't appear again. We are using session cookies here. The popup will display again only if the user closes the browser and revisits your blog or if the visitor visits your blog in a new browser tab. If you want to prevent the popup from appearing again after the browser is closed, then you can use localstorage instead of session storage. All details have already been discussed on HTML5 cookies series.

Looking for a New Year Popup? Check this! Gold Plated New Year Popup

Add Christmas Pop-up to a BlogSpot blog

  1. Go to blogger > Template
  2. Backup your template
  3. Click "Edit HTML"
  4. Paste the following code just above </head>

<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>         <script type="text/javascript" src="http://tools.mybloggertricks.com/mbt-popup.js"></script>         <script type='text/javascript'>             //<![CDATA[                     //Setting Time             TargetDate = "12/25/2017 12:00 AM";             CountActive = true;             CountStepper = -1;             LeadingZero = true;             DisplayFormat = "%%D%% days: %%H%% hrs: %%M%% mins: %%S%% secs";             FinishMessage = "It is finally here!";

            //Hiding snowfall             $(document).ready(function()                         {                            $('a.close-reveal-modal').click(function() {$(document).snowfall('clear');});                 //Setting cookie                                if(sessionStorage.getItem("Hide-MBT-Popup") == 1) {                 $(document).snowfall('clear');                 $(document).snowfall.hide();                 $("#myModal").hide();                                 }                 sessionStorage.setItem("Hide-MBT-Popup", 1);                                 });                                                 $(function() {                         // Setting Animation                         $('#myModal').reveal({                  animation: 'fadeAndPop',                   //fade, fadeAndPop, none                  animationspeed: 300,                       //how fast animtions are                  closeonbackgroundclick: false,              //if you click background will modal close?                  dismissmodalclass: 'close-reveal-modal'    //the class of a button or element that will close an open modal             });                         //Revealing Snowfall             $(document).snowfall({deviceorientation : true, round : true, minSize: 1, maxSize:8,  flakeCount : 250});                         });                         //]]>         </script>         <link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'/>

You can customize almost anything in the above count from flake count till animation style but I will only discuss what is relevant in order to keep things simple:

  • Set time and date by editing : 12/25/2017 12:00 AM I have set it to default Christmas time. The demo shows time for Christmas in 2017. Just to keep the popup alive! :)
  • You can set the CountDown timer text display by editing: %%D%% days: %%H%% hrs: %%M%% mins: %%S%% secs . Make sure not to change the variables starting dn ending with %%. You can choose to display just hours/minutes/seconds or Days/hours/minutes. Edit it as you prefer.
  • Once the countdown timer reaches the target date, it will instead display some message. You can choose to write anything by replacing It is finally here!
  • You can select a different animation style out of the available three by replacing fadeAndPop with fade or none. The animation names are case-sensitive. Make sure you type it as stated above.
  • You can choose to control the snowballs size, speed, count and shape by editing: deviceorientation : true, round : true, minSize: 1, maxSize:8, flakeCount : 250 By setting round to false, you can display square shape snow balls. I would recommend to keep it as it is for natural snowfall effect. flakecount refers to the number of snowballs falling at a time.
  • If you wish to display the popup only once to a visitor and never again in his lifetime then replace sessionStorage  with localStorage. This variable appears twice so replace it twice.

   5.  Next search for  ]]></b:skin> and just above it paste the following styles:

If you wish to display a popup as shown in DEMO1 then use this CSS code:

 

/* -------------------------------------------------- Christmas Popup DEMO1 -------------------------------------------------- */

    #mbt-counter {         padding: 10px;         font-family: oswald, verdana;         background-color: rgba(0, 0, 0, 0)!important;         color: #FFF!important;         position: absolute;         left: 53%;         top: 68%;         font-size: 17px; }

.reveal-modal h1 {         position: absolute;         left: 45%;         font-size: 3em;         color: #FFEA00;         font-family: oswald;         top: 30%;         text-shadow: 2px 4px 12px #000;

        }         .reveal-modal h2 {         position: absolute;         left: 57%;         top: 20%;         font-family: oswald, arial;         font-size: 1.7em;         text-shadow: 2px 4px 10px #000;         color: #FFF; }          .reveal-modal-bg {         position: fixed;         height: 100%;         width: 100%;         background: rgba(0,0,0,.8);         z-index: 100;         display: none;         top: 0;         left: 0;         }         .reveal-modal {         visibility: hidden;         left: 50%;         top:170px;         margin-left: -300px;         width: 550px;         height: 305px;         background: rgba(51, 51, 51, 0) url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjVB8_5l3OcaKKBmbAbuEpzlAh7EqQA3_qz1NTFob7uTcMD7l6qSkXZm8kslw2RpOajToHFKr1n0tmUvvNnzcLLrjY6eT2N3f9wxT7UdWjLY0VKw3STNrrQnJOY4DLErZWI0FPBbFUP7s/s1600/christmas.png) no-repeat -17px 0px;         position: absolute;         z-index: 101;         padding: 30px 40px 34px;         -moz-border-radius: 8px;         -webkit-border-radius: 8px;         border-radius: 8px;         color: #FFF;         }             .reveal-modal.small         { width: 200px; margin-left: -140px;}     .reveal-modal.medium         { width: 400px; margin-left: -240px;}     .reveal-modal.large         { width: 600px; margin-left: -340px;}     .reveal-modal.xlarge         { width: 800px; margin-left: -440px;}         .reveal-modal .close-reveal-modal {         font-size: 32px;         line-height: .5;         position: absolute;         top: 25px;         right: 25px;         color: #bebebe;         text-shadow: 0 -1px 1px rbga(0,0,0,.6);         font-weight: bold;         cursor: pointer;         }                 .reveal-modal .close-reveal-modal:hover {             color:#2d2d2f;         }

Or If you wish to display a popup as shown in DEMO1 then use this CSS code:

/* -------------------------------------------------- Christmas Popup DEMO2 -------------------------------------------------- */

    #mbt-counter {         padding: 10px;         font-family: oswald, verdana;         background-color: rgba(0, 0, 0, 0)!important;         color: #FFF!important;         position: absolute;         left: 5%;         top: 49%;         font-size: 17px; }

    .reveal-modal h1 {         position: absolute;         left: 5%;         font-size: 3em;         color: #FFEA00;         font-family: oswald;         top: 15%;         text-shadow: 2px 4px 12px #000;       

        }     .reveal-modal h2 {         position: absolute;         left: 5%;         top: 5%;         font-family: oswald, arial;         font-size: 1.7em;         text-shadow: 2px 4px 10px #000;         color: #FFF; }          .reveal-modal-bg {         position: fixed;         height: 100%;         width: 100%;         background: rgba(0,0,0,.8);         z-index: 100;         display: none;         top: 0;         left: 0;         }         .reveal-modal {         visibility: hidden;         left: 50%;         top:170px;         margin-left: -300px;         width: 550px;         height: 305px;         background: rgba(51, 51, 51, 0) url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieqsAZnOsfXoK48ubdE3D-XZ1pnlEUCptk3jpdnzQGTr0BhvHxJuMhyphenhyphenDKqaiGCwmfXFLdqkD1rGBxj4JBKPgAvm85rAJ6hFRCxGutU4QxgPTNlROH0V06kkjOR68ZlPh1BgQwquu-jQFQ/s1600/christmas1.png) no-repeat -17px 0px;         position: absolute;         z-index: 101;         padding: 30px 40px 34px;         -moz-border-radius: 8px;         -webkit-border-radius: 8px;         border-radius: 8px;         color: #FFF;         }             .reveal-modal.small         { width: 200px; margin-left: -140px;}     .reveal-modal.medium         { width: 400px; margin-left: -240px;}     .reveal-modal.large         { width: 600px; margin-left: -340px;}     .reveal-modal.xlarge         { width: 800px; margin-left: -440px;}         .reveal-modal .close-reveal-modal {         font-size: 32px;         line-height: .5;         position: absolute;         top: 25px;         right: 25px;         color: #bebebe;         text-shadow: 0 -1px 1px rbga(0,0,0,.6);         font-weight: bold;         cursor: pointer;         }                 .reveal-modal .close-reveal-modal:hover {             color:#2d2d2f;         }

 

   6.  Finally paste the following HTML code just below <body>

<div id="myModal" class="reveal-modal" >     <h2>Count Down Begins!</h2>     <h1>Happy holidays!</h1>     <script type='text/javascript' src="http://tools.mybloggertricks.com/mbt-counter.js"></script>     <a class="close-reveal-modal">&#215;</a>     </div>

You can replaced the bolded text with any message you like.

   7.  Save your template and you are all done!

Visit your blog to see a beautiful message popping up to wish you Happy Winter holidays! :)

You are most welcomed to share it with your readers by attaching an attribution link back to this page.

Need Help?

I hope this popup proves useful for most of you. Its not just attractive but too light in weight and load time perspective. It's time you may welcome your visitors with some winter greetings! :)

Kindly let me know if I could be of any help. Peace and blessings buddies. :)

Create a Christmas Countdown Timer Widget In BlogSpot

Posted: 13 Dec 2017 01:13 PM PST

christmas countdown widget Add a Christmas count down timer widget to your blogger blog to welcome your blog visitors and wish them happy Christmas. This countdown timer widget counts down to 25 December 2017 and in military time format by counting days, hours, minutes and seconds left for the coming Christmas event. It also alerts and wishes Christmas by generating a pop-up once the count down ends. The JavaScript is provided by dynamic drive and it is customized and enhanced by MBT. This widget will be shared on each event here may it be EID, Holi or New Year. I hope you find it useful. It is extremely easy to install and customize it. The best thing about it is that it contains no ads because we are utilizing a free script provided by dynamic drive and storing it on blogger. Lets get to work then!


Live Demo

Add Christmas CountDown Timer Gadget To Blogspot

  1. Go To Blogger > Design
  2. Choose HTML/JavaScript widget
  3. Paste the following code inside it,

<style style="text/css">

.lcdstyle{ /*Example CSS to create LCD countdown look*/
background-color:fff;
color:#FF3333;
font: bold 20px arial;
padding: 15px;

border:5px solid #0080ff;

border-radius:15px;
-moz-border-radius:15px;
-webkit-border-radius:15px;
box-shadow: 5px 5px 5px #CCCCCC;


}

.lcdstyle sup{ /*Example CSS to create LCD countdown look*/
font-size: 120%
}

</style>

<script type="text/javascript">

/***********************************************
* Dynamic Countdown script- © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function cdtime(container, targetdate){
if (!document.getElementById || !document.getElementById(container)) return
this.container=document.getElementById(container)
this.currentTime=new Date()
this.targetdate=new Date(targetdate)
this.timesup=false
this.updateTime()
}

cdtime.prototype.updateTime=function(){
var thisobj=this
this.currentTime.setSeconds(this.currentTime.getSeconds()+1)
setTimeout(function(){thisobj.updateTime()}, 1000) //update time every second
}

cdtime.prototype.displaycountdown=function(baseunit, functionref){
this.baseunit=baseunit
this.formatresults=functionref
this.showresults()
}

cdtime.prototype.showresults=function(){
var thisobj=this


var timediff=(this.targetdate-this.currentTime)/1000 //difference btw target date and current date, in seconds
if (timediff<0){ //if time is up
this.timesup=true
this.container.innerHTML=this.formatresults()
return
}
var oneMinute=60 //minute unit in seconds
var oneHour=60*60 //hour unit in seconds
var oneDay=60*60*24 //day unit in seconds
var dayfield=Math.floor(timediff/oneDay)
var hourfield=Math.floor((timediff-dayfield*oneDay)/oneHour)
var minutefield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour)/oneMinute)
var secondfield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour-minutefield*oneMinute))
if (this.baseunit=="hours"){ //if base unit is hours, set "hourfield" to be topmost level
hourfield=dayfield*24+hourfield
dayfield="n/a"
}
else if (this.baseunit=="minutes"){ //if base unit is minutes, set "minutefield" to be topmost level
minutefield=dayfield*24*60+hourfield*60+minutefield
dayfield=hourfield="n/a"
}
else if (this.baseunit=="seconds"){ //if base unit is seconds, set "secondfield" to be topmost level
var secondfield=timediff
dayfield=hourfield=minutefield="n/a"
}
this.container.innerHTML=this.formatresults(dayfield, hourfield, minutefield, secondfield)
setTimeout(function(){thisobj.showresults()}, 1000) //update results every second
}

/////CUSTOM FORMAT OUTPUT FUNCTIONS BELOW//////////////////////////////

//Create your own custom format function to pass into cdtime.displaycountdown()
//Use arguments[0] to access "Days" left
//Use arguments[1] to access "Hours" left
//Use arguments[2] to access "Minutes" left
//Use arguments[3] to access "Seconds" left

//The values of these arguments may change depending on the "baseunit" parameter of cdtime.displaycountdown()
//For example, if "baseunit" is set to "hours", arguments[0] becomes meaningless and contains "n/a"
//For example, if "baseunit" is set to "minutes", arguments[0] and arguments[1] become meaningless etc


function formatresults(){
if (this.timesup==false){//if target date/time not yet met
var displaystring=arguments[0]+" days "+arguments[1]+" hours "+arguments[2]+" minutes "+arguments[3]+" seconds left until December 25, 2017 18:25:00"
}
else{ //else if target date/time met
var displaystring=""
}
return displaystring
}

function formatresults2(){
if (this.timesup==false){ //if target date/time not yet met
var displaystring="<span class='lcdstyle'>"+arguments[0]+" <sup>days</sup> "+arguments[1]+" <sup>hours</sup> "+arguments[2]+" <sup>minutes</sup> "+arguments[3]+" <sup>seconds</sup></span> "
}
else{ //else if target date/time met
var displaystring="" //Don't display any text
alert("Christmas is here!") //Instead, perform a custom alert
}
return displaystring
}

</script>


<h1 style="color:#0080ff; margin:0;">Happy Holidays!</h1>
<div id="countdowncontainer"></div>
<br />
<div id="countdowncontainer2"></div>

<script type="text/javascript">

var futuredate=new cdtime("countdowncontainer", "March 23, 2009 18:25:00")
futuredate.displaycountdown("days", formatresults)

var currentyear=new Date().getFullYear()
//dynamically get this Christmas' year value. If Christmas already passed, then year=current year+1
var thischristmasyear=(new Date().getMonth()>=11 && new Date().getDate()>25)? currentyear+1 : currentyear
var christmas=new cdtime("countdowncontainer2", "December 25, "+thischristmasyear+" 0:0:00")
christmas.displaycountdown("days", formatresults2)

</script>

 

Make these changes to its colors and font if you wish:

  • To change the color of happy holidays edit color:#0080ff
  • To change the rounded blue border colour and size edit border:5px solid #0080ff
  • To change the Count Down text colour edit color:#FF3333

    4.   Save your widget and say bingo!

Visit your blogs to see it working just perfectly.

Want to CountDown till New Year?

Simply change December 25 to  December 31    and change Christmas is here! to HAPPY NEW YEAR FOLKS! 

If you know basic CSS then you add more flavour and color variation to it. I hope you may find this cool new widget worth using. If you wish to share it with your readers then kindly attach attributes to MBT and dynamic drive. Do let me know if you needed any further help. Peace pals! :)

Share:

0 comments:

Post a Comment