Muchas veces necesitamos dar un aviso a los visitantes sobre el lanzamiento de nuestro proyecto web. Un mensaje de «pagina en construccion» es bastante util. Pero aun mas util, es mostrar un contador hacia atras como mensaje para los visitantes. En este paso a paso se mostrara como usar la libreria CountdownJs, una libreria util para mostrar el tiempo que falta para la posible fecha limite en la que se lanzara el proyecto web.
¿Que Se Necesita?
- Open Sans (Google Font)
- Montserrat (Google Font)
- Libreria jQuery
- Libreria Countdown de jQuery
- Cualquier imagen para el background.
- Un poco de tiempo y algo de paciencia 😉
Estructura De Los Archivos
La estructura de los archivos del proyecto, estaran en tres carpetas y un archivo html:
- Archivo index.html – esto servirá como nuestro archivo principal.
- Carpeta js carpeta – Guarda los archivos JavaScript y jQuery
- Carpeta img carpeta – Guarda la imagen que se usa como fondo.
- Carpeta carpeta css – Almacena los estilos (CSS) que se aplican a la pagina.
Lo Que Vamos A Hacer

El HTML
En la parte del HTML, vamos a envolver todo en un div contenedor mantendrá la totalidad de nuestros elementos. Esto incluirá la cabecera y la sección de los elementos que sostendrán nuestras etiquetas básicas con sus respectivos id y clases. También incluiremos un elemento de pie de página sencilla que contendrá el texto de autor.
Ver Codigo HTML....
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
| <!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>Proximamente!</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,700italic,400,600,300,700,800' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<link href="css/style.css" media="screen" rel="stylesheet">
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/jquery.countdown.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
</head>
<body>
<div class="container">
<header>
<h1>Pronto estará en funcionamiento</h1>
</header>
<section>
<h2>Nos disculpamos por los inconvenientes :)</h2>
<p class="details">Necesitas esperar...</p>
<div id="counter"></div>
<p class="details">Tu correo para conocer mas detalles</p>
<div id="subscribe">
<form action="" id="subscribe-form" method="post" name=
"newsletter-form">
<p class="form-field"><input id="subcribe_email" name=
"subscribe_email" placeholder="Digita tu mail" type="email"
value=""></p>
<p class="form-submit"><input id="subscribe_submit" name=
"subscribe_submit" type="submit" value="Notificame"></p>
</form>
</div>
</section>
<footer>
<a href="https://jagonzalez.org/" target="_blank">Copyleft
- jagonzalez.org - 2014</a>
</footer>
</div>
</body>
</html> |
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>Proximamente!</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,700italic,400,600,300,700,800' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<link href="css/style.css" media="screen" rel="stylesheet">
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/jquery.countdown.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
</head>
<body>
<div class="container">
<header>
<h1>Pronto estará en funcionamiento</h1>
</header>
<section>
<h2>Nos disculpamos por los inconvenientes :)</h2>
<p class="details">Necesitas esperar...</p>
<div id="counter"></div>
<p class="details">Tu correo para conocer mas detalles</p>
<div id="subscribe">
<form action="" id="subscribe-form" method="post" name=
"newsletter-form">
<p class="form-field"><input id="subcribe_email" name=
"subscribe_email" placeholder="Digita tu mail" type="email"
value=""></p>
<p class="form-submit"><input id="subscribe_submit" name=
"subscribe_submit" type="submit" value="Notificame"></p>
</form>
</div>
</section>
<footer>
<a href="https://jagonzalez.org/" target="_blank">Copyleft
- jagonzalez.org - 2014</a>
</footer>
</div>
</body>
</html>
En el anterior codigo, hemos hecho el llamado a las fuentes de google, las librerias JavaScript, el archivo JavaScript, en el cual iniciamos el contador cuando se haya cargado el
DOM y los estilos.
El CSS
Con lo anterior tendremos la estructura, solo el HTML no sera agradable visualmente. Aplicaremos algo de CSS para dar estilo y un elegante efecto en el primer titulo del encabezado 😉
Ver Codigo CSS....
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
| /*
Tutorial Name: Coming Soon Page with Counter
Author: Samuel Dalusung
*/
/* GENERAL STYLES
-------------------------------------------------*/
body {
color: #dadada;
line-height: 1.75;
width: 100%;
background: url(../img/backgroundjava.jpg)center;
font-family: 'Open Sans';
}
h1,h2{
color: #fff;
line-height: 1.16667;
text-align: center;
text-transform: uppercase;
text-shadow: 2px 2px 2px rgba(150,150,150,1);
}
h1 {
font-size: 43px;
font-family: Montserrat;
font-weight: 700;
border: 2px dashed #fff;
margin-top: 50px;
padding: 10px;
cursor: pointer;
-webkit-transition: all .8s ease;
-moz-transition: all .8s ease;
-o-transition: all .8s ease;
transition: all .8s ease;
}
h1:hover {
-webkit-transform: rotateX(360deg);
-moz-transform: rotateX(360deg);
-ms-transform: rotateX(360deg);
-o-transform: rotateX(360deg);
transform: rotateX(360deg);
}
h2 {
font-size: 30px;
font-weight: 300;
margin-top: 30px;
}
.container {
width: 58%;
margin: 40px auto 0;
}
/* FORMS
-------------------------------------------------*/
button,input,textarea {
font-size: 16px;
max-width: 100%;
margin: -16px;
border-radius: 0;
vertical-align: baseline;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
textarea {
overflow: auto;
vertical-align: top;
}
input,textarea {
background: #6e6e6e;
background: rgba(169,169,169,0.3);
border: 1px solid #f4f4f4;
color: #fff;
font-weight: 700;
letter-spacing: 1px;
padding: 12px;
text-transform: uppercase;
}
input:focus,textarea:focus {
outline: 0;
}
button:hover,button:focus,input[type=submit]:focus,input[type=submit]:hover {
background: #ff8721;
color: #fff;
outline: 0;
}
button,input[type=submit] {
-webkit-appearance: button;
cursor: pointer;
}
button,input[type=submit] {
background: #ffab00;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
.form-field {
position: relative;
}
/* PLACEHOLDER
-------------------------------------------------*/
::-webkit-input-placeholder {
color: #fff;
}
::-moz-placeholder {
color: #fff;
opacity: 1;
}
::-ms-input-placeholder {
color: #fff;
opacity: 1;
}
.placeholder {
color: #ff;
}
/* TIMER
-------------------------------------------------*/
#counter {
margin-top: 28px;
}
.countdown_section {
color: #ff0000;
display: inline-block;
font-size: 18px;
font-weight: bold;
text-align: center;
width: 25%;
letter-spacing: 1px;
border-left: 1px dashed #dadada;
border-color: rgba(218,218,218,0.8);
padding: 42px 12px 28px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
text-shadow: 2px 2px 2px rgba(150,150,150,1);
text-transform: uppercase;
}
.countdown_section:first-child {
border-left: 0;
}
.countdown_amount {
color: black;
display: block;
font-family: 'Open Sans';
font-size: 60px;
font-weight: 700;
letter-spacing: normal;
line-height: 1;
}
/* SUBSCRIBE
-------------------------------------------------*/
#subscribe {
max-width: 610px;
position: relative;
margin: 20px auto 0;
}
.details {
margin-top: 30px;
color: #fff;
text-align: center;
text-shadow: 2px 2px 2px rgba(150,150,150,1);
}
#subscribe-form .form-field {
margin-right: 180px;
}
#subcribe_email {
border-right: 0;
}
#subscribe-form .form-submit {
height: 50px;
position: absolute;
right: 0;
top: 0;
width: 180px;
}
#subcribe_email,#subscribe_submit {
width: 100%;
display: block;
height: 55px;
}
/* FOOTER
-------------------------------------------------*/
footer {
font-size: 13px;
text-align: center;
margin-top: 25px;
text-transform: uppercase;
text-shadow: 2px 2px 2px rgba(150,150,150,1);
}
footer a {
color: #fff;
}
/* RESPONSIVE MEDIA QUERIES
-------------------------------------------------*/
@media only screen and (max-width: 720px) {
footer{margin-bottom: 40px; }
}
@media only screen and (max-width: 680px) {
.countdown_amount {
font-size: 48px;
}
}
@media only screen and (max-width: 540px) {
.one-half {
width: 100%;
}
.countdown_section {
padding: 28px 6px 20px;
}
#subcribe_email{border: 1px solid #fff;}
#subscribe-form .form-submit {
margin: 0 auto;
right: auto;
position: static;
}
#subscribe-form .form-field {
margin: 0 0 14px;
}
}
@media only screen and (max-width: 480px) {
h1 {
font-size: 30px;
}
h2{font-size: 25px;}
.countdown_section {
border: none;
padding: 20px 20px;
font-size: 13px;
text-align: center;
}
.countdown_amount {
font-size: 40px;
padding: 0 0 10px 0;
}
#counter{width: 30%; margin:0 auto;}
}
@media only screen and (max-width: 360px) {
h2{font-size: 22px;}
.countdown_section {
padding: 21px 26px 21px 15px;
}
.countdown_amount {
font-size: 36px;
}
} |
/*
Tutorial Name: Coming Soon Page with Counter
Author: Samuel Dalusung
*/
/* GENERAL STYLES
-------------------------------------------------*/
body {
color: #dadada;
line-height: 1.75;
width: 100%;
background: url(../img/backgroundjava.jpg)center;
font-family: 'Open Sans';
}
h1,h2{
color: #fff;
line-height: 1.16667;
text-align: center;
text-transform: uppercase;
text-shadow: 2px 2px 2px rgba(150,150,150,1);
}
h1 {
font-size: 43px;
font-family: Montserrat;
font-weight: 700;
border: 2px dashed #fff;
margin-top: 50px;
padding: 10px;
cursor: pointer;
-webkit-transition: all .8s ease;
-moz-transition: all .8s ease;
-o-transition: all .8s ease;
transition: all .8s ease;
}
h1:hover {
-webkit-transform: rotateX(360deg);
-moz-transform: rotateX(360deg);
-ms-transform: rotateX(360deg);
-o-transform: rotateX(360deg);
transform: rotateX(360deg);
}
h2 {
font-size: 30px;
font-weight: 300;
margin-top: 30px;
}
.container {
width: 58%;
margin: 40px auto 0;
}
/* FORMS
-------------------------------------------------*/
button,input,textarea {
font-size: 16px;
max-width: 100%;
margin: -16px;
border-radius: 0;
vertical-align: baseline;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
textarea {
overflow: auto;
vertical-align: top;
}
input,textarea {
background: #6e6e6e;
background: rgba(169,169,169,0.3);
border: 1px solid #f4f4f4;
color: #fff;
font-weight: 700;
letter-spacing: 1px;
padding: 12px;
text-transform: uppercase;
}
input:focus,textarea:focus {
outline: 0;
}
button:hover,button:focus,input[type=submit]:focus,input[type=submit]:hover {
background: #ff8721;
color: #fff;
outline: 0;
}
button,input[type=submit] {
-webkit-appearance: button;
cursor: pointer;
}
button,input[type=submit] {
background: #ffab00;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
.form-field {
position: relative;
}
/* PLACEHOLDER
-------------------------------------------------*/
::-webkit-input-placeholder {
color: #fff;
}
::-moz-placeholder {
color: #fff;
opacity: 1;
}
::-ms-input-placeholder {
color: #fff;
opacity: 1;
}
.placeholder {
color: #ff;
}
/* TIMER
-------------------------------------------------*/
#counter {
margin-top: 28px;
}
.countdown_section {
color: #ff0000;
display: inline-block;
font-size: 18px;
font-weight: bold;
text-align: center;
width: 25%;
letter-spacing: 1px;
border-left: 1px dashed #dadada;
border-color: rgba(218,218,218,0.8);
padding: 42px 12px 28px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
text-shadow: 2px 2px 2px rgba(150,150,150,1);
text-transform: uppercase;
}
.countdown_section:first-child {
border-left: 0;
}
.countdown_amount {
color: black;
display: block;
font-family: 'Open Sans';
font-size: 60px;
font-weight: 700;
letter-spacing: normal;
line-height: 1;
}
/* SUBSCRIBE
-------------------------------------------------*/
#subscribe {
max-width: 610px;
position: relative;
margin: 20px auto 0;
}
.details {
margin-top: 30px;
color: #fff;
text-align: center;
text-shadow: 2px 2px 2px rgba(150,150,150,1);
}
#subscribe-form .form-field {
margin-right: 180px;
}
#subcribe_email {
border-right: 0;
}
#subscribe-form .form-submit {
height: 50px;
position: absolute;
right: 0;
top: 0;
width: 180px;
}
#subcribe_email,#subscribe_submit {
width: 100%;
display: block;
height: 55px;
}
/* FOOTER
-------------------------------------------------*/
footer {
font-size: 13px;
text-align: center;
margin-top: 25px;
text-transform: uppercase;
text-shadow: 2px 2px 2px rgba(150,150,150,1);
}
footer a {
color: #fff;
}
/* RESPONSIVE MEDIA QUERIES
-------------------------------------------------*/
@media only screen and (max-width: 720px) {
footer{margin-bottom: 40px; }
}
@media only screen and (max-width: 680px) {
.countdown_amount {
font-size: 48px;
}
}
@media only screen and (max-width: 540px) {
.one-half {
width: 100%;
}
.countdown_section {
padding: 28px 6px 20px;
}
#subcribe_email{border: 1px solid #fff;}
#subscribe-form .form-submit {
margin: 0 auto;
right: auto;
position: static;
}
#subscribe-form .form-field {
margin: 0 0 14px;
}
}
@media only screen and (max-width: 480px) {
h1 {
font-size: 30px;
}
h2{font-size: 25px;}
.countdown_section {
border: none;
padding: 20px 20px;
font-size: 13px;
text-align: center;
}
.countdown_amount {
font-size: 40px;
padding: 0 0 10px 0;
}
#counter{width: 30%; margin:0 auto;}
}
@media only screen and (max-width: 360px) {
h2{font-size: 22px;}
.countdown_section {
padding: 21px 26px 21px 15px;
}
.countdown_amount {
font-size: 36px;
}
}
Con esto, la pagina tendra un elegante estilo, pero no se vera el contador. Esto se debe a que no hemos iniciado el contador cuando se carga el DOM. Para esto usaremos nuestro archivo JavaScript, con unas simples lineas 🙂
El JavaScript
Usaremos el jQuery para saber cuando se ha cargado los elementos de la paginas, seguidamente creamos una fecha, la cual será el lanzamiento del proyecto:
Ver Codigo Js....
1
2
3
4
5
6
| $(document).ready(function() {
var launchdate = new Date(2014, 9 - 1, 7);//la fecha de lanzamiento del proyecto
$('#counter').countdown({
until: launchdate
});
}); |
$(document).ready(function() {
var launchdate = new Date(2014, 9 - 1, 7);//la fecha de lanzamiento del proyecto
$('#counter').countdown({
until: launchdate
});
});
Descarga El Proyecto!
Puedes descargar la carpeta del proyecto con los archivos y así poder modificarlos a tu gusto. Solo tienes compartir el articulo con los botones de abajo, una vez lo hayas compartido, no debes de salirte de la ventana o pestaña del articulo, seguidamente aparecerá el botón de la descarga 😉 Ayuda a que este articulo lo conozcan mas personas 🙂
[l2g facebook=»true» twitter=»true» gplusone=»true»]

[/l2g]
Finalmente
¡Felicitaciones! Acabas de crear una página fantástica de «coming soon» con un contador. Cuando los visitantes lleguen a la pagina de «proximamente», muchas veces no volveran, la causa, es que no se les hace saber cuando sera lanzada o estara en funcionamiento la pagina.
La adición de un contador, les informara acerca de la fecha en la que se puede comprobar el sitio de nuevo. Espero que este pequeño paso a paso haya sido de gran utilidad.
vamo lo pibe
Muchisimas Gracias Amigo