ASP.NET MVC: Jquery Coming Soon Counter Plugin
When you are about to launch a new website, promotion or sale, it is important to let your customers base know about remaining launch time, so that your customers don't need to calculate the remaining time by themselves.
Today, I shall be demonstrating the integration of Jquery Countdown plugin with ASP.NET MVC5 platform.
1) Create a new MVC web project and name it "CounterPlugin".
2) Download & Install Jquery Countdown Plugin.
3) Create a "Controllerss\HomeController.cs" file with default Index method and it s subsequent view "Views\Home\Index.cshtml" with following lines of code i.e.
4) Now, create the JavaScript file "Scripts\script-custom-countdown.js" with the following lines of code i.e.
5) Now, execute the provided solution and you will be able to see the following in action i.e.
Today, I shall be demonstrating the integration of Jquery Countdown plugin with ASP.NET MVC5 platform.
Prerequisites:
Following are some prerequisites before you proceed any further in this tutorial:- Knowledge of Jquery.
- Knowledge of HTML.
- Knowledge of JavaScript.
- Knowledge of Bootstrap.
- Knowledge of ASP.NET MVC5.
- Knowledge of C# Programming.
Download Now!
Let's begin now.1) Create a new MVC web project and name it "CounterPlugin".
2) Download & Install Jquery Countdown Plugin.
3) Create a "Controllerss\HomeController.cs" file with default Index method and it s subsequent view "Views\Home\Index.cshtml" with following lines of code i.e.
... <div class="row"> <div id="countdown"></div> <p id="countdown-detail"></p> </div> ...
In the above code, I have simply created my target 'div' and paragraph where my coming soon counter will be displayed.
4) Now, create the JavaScript file "Scripts\script-custom-countdown.js" with the following lines of code i.e.
... timeLeftForLaunch = (new Date()).getTime() + 5 * 24 * 60 * 60 * 1000; // days * hours * min * sec * milliseconds $('#countdown').countdown({ timestamp: timeLeftForLaunch, callback: function (days, hours, minutes, seconds) { var message = "Launch Coming Soon in " + days + " days " + hours + " hours " + minutes + " minutes and " + seconds + " seconds "; ... $('#countdown-detail').html(message); } }); ...
In the above code, I have initialized current date with time and add the number of days, hours, minutes and seconds (in milliseconds) left for the launch or may be a website, promotion or sale etc.
5) Now, execute the provided solution and you will be able to see the following in action i.e.
This article is very necessary and very helpful article. Thank you for telling me about this article. I know of a school & fashion house that has a good education in fashion. Fashion training schools in accra Riohs Originate is a Creative Art Service and Training Institute in Ghana. https://riohs.com
ReplyDeleteThey provide services and training for individuals/organizations that value their image, style, color and insist on promptness, accuracy and consistency.