Home Web Front-end JS Tutorial JQuery imitates Xiaomi mobile phone rush purchase page countdown effect_jquery

JQuery imitates Xiaomi mobile phone rush purchase page countdown effect_jquery

May 16, 2016 pm 04:26 PM
jquery Countdown Xiaomi mobile phone

1. Effect and function description

Tell users how much time is left for an activity by controlling time, accurate to seconds.

2. Implementation principle

First define the end time of the activity. The year must be accurate to milliseconds. After getting the current year to seconds, use the end time and subtract the current time. The remaining time will be determined by the time remaining. The time below is displayed and you can see how long it is until the deadline.

Main Code

Copy code The code is as follows:

var startTime = new Date();
//Get the current time
startTime.setFullYear(2016, 5, 27);
//Call to set the year
startTime.setHours(23);
//Call to set the hour field of the specified time
startTime.setMinutes(59);
//Call to set the minute field of the specified time
startTime.setSeconds(59);
//Call to set the seconds field of the specified time
startTime.setMilliseconds(999);
//Call to set the millisecond field of the specified time
var EndTime=startTime.getTime();
//Get the ending time
var nMS = EndTime - NowTime.getTime();
//Subtract the current time from the end time to get the remaining time
var nD = Math.floor(nMS/(1000 * 60 * 60 * 24));
//Define parameters to get the number of days
var nH = Math.floor(nMS/(1000*60*60)) % 24;
//Define parameters to get hour
var nM = Math.floor(nMS/(1000*60)) % 60;
//Define parameters to get minutes
var nS = Math.floor(nMS/1000) % 60;
//Define parameters to get seconds. These are the current time

3. Operating environment
IE6 IE7 IE8 and above Firefox and Google
It can be realized in Chrome browser

4. Create a new file for the compressed package of all pictures, and then unzip the package and put it into a folder. The compressed package of the pictures can be seen and downloaded at the bottom of the page. After downloading, there is no need to modify the folder name because it has already been written and The path within html5 matches

5. When saving the created html file, change the encoding type to (UTF-8 with signature) so that some Chinese characters can be displayed normally. Change the saving type (T) to (all files (*.*) ), put the html5 and decompressed image folders in the same folder

6. Code

Copy code The code is as follows:









7. After the countdown is completed, set the hidden attribute of the button to false, simple~

This code is taken from my project. Friends can use it with confidence. If you have any questions, please leave a message.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to disable screen time management on Xiaomi mobile phone_Steps to disable screen time management on Xiaomi mobile phone How to disable screen time management on Xiaomi mobile phone_Steps to disable screen time management on Xiaomi mobile phone Mar 25, 2024 pm 06:50 PM

1. Open [Settings] on your phone and click [Screen Time Management]. 2. After entering, click the three-dot icon in the upper right corner. 3. In the pop-up options, click [Disable Screen Time Management]. 4. Click [OK]. The screen usage record will be automatically cleared after successful closing.

Where to turn on the gps positioning of Xiaomi mobile phone Where to turn on the gps positioning of Xiaomi mobile phone Mar 02, 2024 pm 05:37 PM

Where can I turn on the GPS positioning on Xiaomi mobile phones? You can turn on the GPS positioning on Xiaomi phones, but most users don’t know where to turn on the GPS positioning. Next is the graphic tutorial on how to turn on the GPS positioning on Xiaomi phones brought by the editor. Interested users come and take a look! Where to turn on the GPS positioning of Xiaomi mobile phone? 1. First open the settings function in Xiaomi mobile phone and select [Privacy Protection]; 2. Then on the page shown below, click the [Location Information] service; 3. Finally, in the location information interface , slide the button behind [Turn on location services] to turn it on.

Xiaomi Civi 4 Pro Disney Princess Limited Edition Invitation Gift Box Photo Gallery: Magic Mirror, Poison Apple... Xiaomi Civi 4 Pro Disney Princess Limited Edition Invitation Gift Box Photo Gallery: Magic Mirror, Poison Apple... Jun 26, 2024 pm 05:08 PM

According to news on June 26, Xiaomi Civi4Pro Disney Princess Limited Edition mobile phone has been officially announced and will be officially released at 19:00 tomorrow (June 27). At present, the evaluation room has received the Xiaomi Civi4Pro Disney Princess limited edition invitation gift box. Next, I will bring you real-life pictures of this set of deeply customized invitation gift boxes! Let me briefly introduce the content of this invitation. It looks like a huge square purple box with a deep color and a sense of mystery. After opening the box, it contains a purple limited edition poison apple and a mirror. The combination of poisonous apple and magic mirror reminds us of the classic story of Snow White. In addition, there is also a purple invitation card with information about the press conference printed on it. Last year, Xiaomi based on Civi3

Where to change the input method of Xiaomi mobile phone_The steps to set up the input method of Xiaomi mobile phone Where to change the input method of Xiaomi mobile phone_The steps to set up the input method of Xiaomi mobile phone Mar 25, 2024 pm 01:36 PM

1. Click [More settings] in the phone settings menu. 2. Click [Language and Input Method]. 3. Click [Input Method Management]. 4. Click [Settings] to set the input method.

What should I do if the volume buttons on my Xiaomi phone jump by themselves? What should I do if the volume buttons on my Xiaomi phone jump by themselves? Mar 02, 2024 pm 05:37 PM

What should I do if the volume keys on Xiaomi phones jump out on their own? In Xiaomi phones, the volume keys may jump out on their own, but most users don’t know how to solve the problem. The following is what the editor brings to users. Tutorial on how to solve the problem of volume buttons popping up on Xiaomi mobile phones. Interested users should come and take a look! What should I do if the volume keys on my Xiaomi phone jump by themselves? 1. First open the [Settings] function in the Xiaomi phone and click [Sound] on the settings page; 2. Then on the sound function page, click [Press the volume keys to control by default] service; 3. Then a small window pops up below, check the [Ringtone Volume] option; 4. Finally enter the page shown in the picture below, click [Press Volume Key to Default Control], return to the mobile phone desktop to solve the problem.

How to restore deleted notes on "Xiaomi Phone" How to restore deleted notes on "Xiaomi Phone" Mar 22, 2024 pm 12:20 PM

If you accidentally deleted notes on your Xiaomi phone, don’t worry as you can restore them with some simple steps. In this article, we will teach you how to recover deleted Xiaomi phone notes so that you can easily retrieve important information. How to recover deleted sticky notes on Xiaomi mobile phone 1. First, use the sticky notes function in Xiaomi mobile phone and enter the main page; 2. Then find the [Sticky Notes] guided by the arrow shown in the figure below on the main page; 3. Then the function bar will expand and select Among them, [Trash]; 4. Then on the Trash function page, find the note file you want to restore and click on it; 5. Finally, expand the latest window at the bottom and click [Restore].

Xiaomi Mi 14 Ultra mobile phone received HyperOS 1.0.7.0 public beta update: new camera handle charging control switch Xiaomi Mi 14 Ultra mobile phone received HyperOS 1.0.7.0 public beta update: new camera handle charging control switch Mar 22, 2024 pm 12:27 PM

According to news on March 21, Xiaomi Mi 14 Ultra mobile phone received a public beta update of HyperOS today, with the version number 1.0.7.0.UNACNXM and the update package size being 626MB. The content of this update is as follows: the system has added a charging control switch for the camera handle; a new function of synchronizing vital sign information via Tiantong SMS (requires Xiaomi Sports Health version 3.27.2); a new function of automatically sending help after using satellite calls in SOS mode SMS function; optimized touch experience. The camera optimizes the HDR imaging effect in some scenes; optimizes the clarity of portrait scene shooting; optimizes the metering weight-face brightness strategy under the environment priority option. It is reported that Xiaomi’s professional photography handle uses a Type-C interface connection, eliminating the need for accessories.

Where to enable OTG function on Xiaomi mobile phone Where to enable OTG function on Xiaomi mobile phone Mar 05, 2024 pm 05:58 PM

The OTG function that comes with Xiaomi 14 is a technology that allows mobile phones to directly read U disk, hard disk and other data through the USB interface. Through the OTG function, users can read and copy files in the U disk and hard disk on Xiaomi mobile phones. , modification and other operations. So how to enable the OTG function in Xiaomi Mi 14? Users who want to know should come and follow this article to find out! First, we open the settings page of Xiaomi 14, click on more settings options, and then in the more settings page, find the OTG function option. After entering the OTG function page, we turn on the switch behind OTG. The above is what the editor of this site will tell you. Here is a detailed guide on how to enable the OTG function on Xiaomi Mi 14. Friends, you will know more about it after reading this tutorial guide.

See all articles