By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
LahbabiGuideLahbabiGuide
  • الرئيسية
  • مزيج مِن أفكاري
    • مقالاتي
    • قصص قصيرة
    • سيناريوهات أفلام قصيرة
    • نصوص مسرحية قصيرة
  • أفكار المشاريع
  • قصص النجاح
  • أخبار تقنية
  • القرأن الكريم
Search
  • Advertise
© 2022 Zakariaelahbabi.com . Company. All Rights Reserved.
Reading: New Years Countdown Timer With jQuery and Bootstrap Layout | Time Left
Share
Notification Show More
Latest News
bootstrap-clean-buttons-with-hover-effect-|-plain-button-ui-kit
Bootstrap Clean Buttons With Hover Effect | Plain Button UI Kit
Bootstrap
bootstrap-datatable-with-sort,-pagination,-and-search-|-sorting-data-table
Bootstrap Datatable With Sort, Pagination, and Search | Sorting Data Table
Bootstrap
upload-image-in-php-with-mysql-database-|-web-dev-trick
Upload Image In PHP With MySQL Database | Web Dev Trick
PHP
bootstrap-tooltip-progress-bar-animation-|-percentage-values-in-tooltip
Bootstrap Tooltip Progress Bar Animation | Percentage Values in Tooltip
Bootstrap
php-age-calculator-program-|-calculate-age-in-php
PHP Age Calculator Program | Calculate Age In PHP
PHP
Aa
LahbabiGuideLahbabiGuide
Aa
  • مزيج مِن أفكاري
  • أخبار تقنية
  • تطوير الويب
  • أفكار المشاريع
Search
  • Home
    • Home 1
    • Default Home 2
    • Default Home 3
    • Default Home 4
    • Default Home 5
  • Categories
    • تطوير الويب
    • أخبار تقنية
    • أفكار المشاريع
    • مزيج مِن أفكاري
    • قصص النجاح
  • Bookmarks
  • More Foxiz
    • Sitemap
Follow US
  • Advertise
© 2022 Foxiz News Network. Ruby Design Company. All Rights Reserved.
new-years-countdown-timer-with-jquery-and-bootstrap-layout-|-time-left
LahbabiGuide > تطوير الويب > Bootstrap > New Years Countdown Timer With jQuery and Bootstrap Layout | Time Left
Bootstrap

New Years Countdown Timer With jQuery and Bootstrap Layout | Time Left

admin
Last updated: 2023/03/11 at 7:37 صباحًا
By admin
Share
12 Min Read
SHARE

How we can create a countdown timer to show how time left for the new year? Solution: See this New Years Countdown Timer With jQuery and Bootstrap Layout, Time Left Check.

Contents
Preview Of Time Left For 1 January ProgramNew Years Countdown Timer Source CodeNew Year Countdown

Previously I have shared a JavaScript countdown timer, this is also similar to that but it’s for the new year and with a neon glow effect on hover. Basically, this new years countdown is for showing how many days, hours, minutes, and seconds left for January 1st or new year. Now the time gap fills then the timer will become a greeting message.

Today you will learn to create a program to check how many times left for 2020. Basically, there is a heading and four boxes, the heading is info about the program and the first box is for showing days, second for hours, third for minutes, and fourth for the second. On new year I men 1st of January it becomes a happy new year message. And the cool fact of this program is, it has a neon glow effect on hover.

So, Today I am sharing New Years Countdown Timer With jQuery and Bootstrap Layout. There I have used bootstrap for responsive layout design with less CSS codes, and countdown programs based on jQuery. As we know it is a JS library that’s why I am putting this program in the JavaScript category. You can use this program on your website for information and give a wish about the new year.

If you are thinking now how the program actually is, then see the preview given below.

Preview Of Time Left For 1 January Program

See this video preview to getting an idea of how this program looks like.

https://webdevtrick.com/wp-content/uploads/countdown-timer.mp4

Live Demo

Now you can see this visually, also you can see it live by pressing the button given above. If you like this, then get the source code of its.

You May Also Like:

  • Step By Step Form
  • Option Tag Select Menu
  • Real Time Digital Clock
  • Responsive Timeline Slider

New Years Countdown Timer Source Code

Before sharing source code, let’s talk about it. First I have created the layout using the bootstrap grid system ( col-md-*, cod-lg-*, etc). I have created two sections for each box, one for top content and one for bottom content. The top part contains the number and the bottom part contains like day, hour, etc. In the HTML file, I have created many divs for creating the layout with pre-built class names.

Now using CSS I have done little things like neon hover effect, and gave border-radius to creating a rounded rectangle. As you know Bootstrap is used for creating responsive elements, but there I have used CSS @media query for reducing the size of some elements on a small screen. The neon glow is based on the text-shadow command.

jQuery handling here the countdown feature of this program. First, it gets the current date and time and checks the gap between 1 January. There I have used JS math command for calculating days, hours, minutes, and seconds. When the time gap becomes complete it will show a happy new year greeting message.

Left all other things you will understand after getting the codes, I can’t explain all in writing. For creating this program you have to create 3 files. First file for HTML, second for CSS, and the third file for JavaScript. Follow the steps to creating this program without any error.

index.html

Create an HTML file named ‘index.html‘ and put these codes given below.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

lang=“en” >

  charset=“UTF-8”>

  </span><span>New Year Countdown | Webdevtrick.com</span><span>

  rel=‘stylesheet’ href=‘https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css’>

  rel=“stylesheet” href=“style.css”>

class=“wrapper”>

  

class=“container text-center”>

    

class=“col-md-12”>

      

id=“header” class=“”>New Year Countdown

    

    

class=“col-md-3 col-xs-6”>

      

class=“clock”>

        

class=“well top-section”>

          

id=“days” class=“num”>00

        

        

class=“well bottom-section”>

          

id=“days-text” class=“text”>Days

        

      

    

    

class=“col-md-3 col-xs-6”>

      

class=“clock”>

        

class=“well top-section”>

          

id=“hours” class=“num”>00

        

        

class=“well bottom-section”>

          

id=“hours-text” class=“text”>Hours

        

      

    

    

class=“col-md-3 col-xs-6”>

      

class=“clock”>

        

class=“well top-section”>

          

id=“mins” class=“num”>00

        

        

class=“well bottom-section”>

          

id=“mins-text” class=“text”>Minutes

        

      

    

    

class=“col-md-3 col-xs-6”>

      

class=“clock”>

        

class=“well top-section”>

          

id=“secs” class=“num”>00

        

        

class=“well bottom-section”>

          

id=“secs-text” class=“text”>Seconds

        

      

    

    

id=“info” class=“small”>

  

style.css

Create a CSS file named ‘style.css‘ and put these codes given here.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

/* Code By Webdevtrick ( https://webdevtrick.com ) */

html {

  height: 100%;

  background: radial-gradient(ellipse at bottom, #1B2735 0%, #090A0F 100%);

  overflow: hidden;

}

body {

  background: transparent;

  color: #ffffff;

}

.bluelight {

  text-shadow: 0 0 10px #3498DB,

               0 0 20px #3498DB,

               0 0 30px #3498DB,

               0 0 40px #2980B9,

               0 0 70px #2980B9,

               0 0 80px #2980B9,

               0 0 100px #2980B9,

               0 0 150px #2980B9;

}

.clock {

    overflow: hidden;

}

.col-md-12 {

    overflow: hidden;

    padding-bottom: 20px;

}

.top-section {

  margin-bottom: 0px;

  border-radius: 5px 5px 0px 0px;

  background-color: #34495E;

  border: 0px;

}

.bottom-section {

  margin-top: 0px;

  border-radius: 0px 0px 5px 5px;

  background-color: #2C3E50;

  border: 0px;

}

@media (min-width: 768px) {

  .num {

    font-size: 100px;

  }

}

@media (max-width: 767px) {

  .num {

    font-size: 50px;

  }

}

@media (max-width: 480px) {

  .num {

    font-size: 30px;

  }

}

@media (min-width: 768px) {

  .text {

    font-size: 35px;

  }

}

@media (max-width: 767px) {

  .text {

    font-size: 20px;

  }

}

@media (max-width: 480px) {

  .text {

    font-size: 15px;

  }

}

@media (min-width: 768px) {

  body {

    padding-top: 75px;

  }

}

h1 {

  padding-top: 10px;

}

@media (min-width: 768px) {

  h1 {

    margin-bottom: 75px;

    font-size: 100px;

  }

}

function.js

The final step, create a JavaScript file named ‘function.js‘ and put the codes.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

// Code By Webdevtrick ( https://webdevtrick.com )

function timeLeft(endtime){

  var t = Date.parse(endtime) – Date.parse(new Date());

  var seconds = Math.floor( (t/1000) % 60 );

  var minutes = Math.floor( (t/1000/60) % 60 );

  var hours = Math.floor( (t/(1000*60*60)) % 24 );

  var days = Math.floor( t/(1000*60*60*24) );

  return {

    ‘total’: t,

    ‘days’: days,

    ‘hours’: hours,

    ‘minutes’: minutes,

    ‘seconds’: seconds

  };

};

$(document).ready(function() {

  var today = new Date();

  var deadline = ‘January 1 ‘ + (today.getFullYear() + 1) + ” 00:00:00″;

  if (today.getMonth() == 0 && today.getDate() == 1) {

    deadline = ‘January 1 ‘ + (today.getFullYear()) + ” 00:00:00″;

  };

  $(“#header”).hover(function() {

    $(this).toggleClass(‘bluelight’);

  });

  $(“.clock”).hover(function() {

    $(this).toggleClass(‘bluelight’);

  });

  var setClock = function(newyear){

    var timeinterval = setInterval(function(){

      var t = timeLeft(newyear);

      $(‘#days’).text(t.days);

      $(‘#hours’).text(t.hours);

      $(‘#mins’).text((‘0’ + t.minutes).slice(–2));

      $(‘#secs’).text((‘0’ + t.seconds).slice(–2));

      if(t.total<=0){

        clearInterval(timeinterval);

        var now = new Date();

        var yearStr = now.getFullYear().toString();

        $(‘#header’).text(“Happy New Year!!!”);

        $(‘#days’).text(yearStr[0]);

        $(‘#days-text’).text(“Happy”);

        $(‘#hours’).text(yearStr[1]);

        $(‘#hours-text’).text(“New”);

        $(‘#mins’).text(yearStr[2]);

        $(‘#mins-text’).text(“Year”);

        $(‘#secs’).text(yearStr[3]);

        $(‘#secs-text’).text(“!!!”);

        $(‘#info’).text(“Countdown starts again tomorrow!”);

      }

    },1000);

  };

  setClock(deadline);

});

That’s It. Now you have successfully created New Years Countdown Timer With jQuery and Bootstrap Layout, Time Left Check Program. If you have any doubt or question comment down below.

Thanks For Visiting, Keep Visiting.

You Might Also Like

Bootstrap Clean Buttons With Hover Effect | Plain Button UI Kit

Bootstrap Datatable With Sort, Pagination, and Search | Sorting Data Table

Upload Image In PHP With MySQL Database | Web Dev Trick

PHP Age Calculator Program | Calculate Age In PHP

Bootstrap Tooltip Progress Bar Animation | Percentage Values in Tooltip

TAGGED: 2020, Bootstrap, countdown, CSS, hover, JavaScript, jquery, neon effect, new year, responsive, source code, Web Development
admin مارس 11, 2023
Share this Article
Facebook Twitter Pinterest Whatsapp Whatsapp LinkedIn Tumblr Reddit VKontakte Telegram Email Copy Link Print
Previous Article php-calculator-example-with-source-code-|-basic-calculator-in-php PHP Calculator Example With Source Code | Basic Calculator in PHP
Next Article generate-random-numbers-in-php-|-numbers-in-sort-by-order Generate Random Numbers In PHP | Numbers In Sort By Order
Leave a comment Leave a comment

اترك تعليقاً إلغاء الرد

لن يتم نشر عنوان بريدك الإلكتروني. الحقول الإلزامية مشار إليها بـ *

Stay Connected

235.3k Followers Like
69.1k Followers Follow
11.6k Followers Pin
56.4k Followers Follow
136k Subscribers Subscribe
4.4k Followers Follow
- Advertisement -
Ad imageAd image

Latest News

bootstrap-clean-buttons-with-hover-effect-|-plain-button-ui-kit
Bootstrap Clean Buttons With Hover Effect | Plain Button UI Kit
Bootstrap مارس 11, 2023
bootstrap-datatable-with-sort,-pagination,-and-search-|-sorting-data-table
Bootstrap Datatable With Sort, Pagination, and Search | Sorting Data Table
Bootstrap مارس 11, 2023
upload-image-in-php-with-mysql-database-|-web-dev-trick
Upload Image In PHP With MySQL Database | Web Dev Trick
PHP مارس 11, 2023
bootstrap-tooltip-progress-bar-animation-|-percentage-values-in-tooltip
Bootstrap Tooltip Progress Bar Animation | Percentage Values in Tooltip
Bootstrap مارس 11, 2023
//

We influence 20 million users and is the number one business and technology news network on the planet

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

[mc4wp_form id=”847″]

LahbabiGuideLahbabiGuide
Follow US

© 2022 Foxiz News Network. Ruby Design Company. All Rights Reserved.

Join Us!

Subscribe to our newsletter and never miss our latest news, podcasts etc..

[mc4wp_form]
Zero spam, Unsubscribe at any time.

Removed from reading list

Undo
Welcome Back!

Sign in to your account

Lost your password?