jQuery UI ejemplo - barra de progreso (ProgressBar)
Mostrar un determinado proceso o estado de incertidumbre.
Para más detalles sobre el miembro progressbar, consulte la documentación de la API miembro de barra de progreso (Progressbar el widget) .
La función predeterminada
El valor por defecto se determina barra de progreso.
<! DOCTYPE html> <Html lang = "es"> <Head> <Charset Meta = "UTF-8"> <Título> jQuery UI barra de progreso (ProgressBar) - La función por defecto </ title> <Link rel = "stylesheet" href = "// code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <Script src = "// code.jquery.com/jquery-1.9.1.js"> </ script> <Script src = "// code.jquery.com/ui/1.10.4/jquery-ui.js"> </ script> <Link rel = "stylesheet" href = "http://jqueryui.com/resources/demos/style.css"> <Script> $ (Function () { $ ( "#progressbar") .progressbar ({ Valor: 37 }); }); </ Script> </ Head> <Cuerpo> <Div id = "progressbar"> </ div> </ Body> </ Html>
Etiqueta personalizada
etiqueta de actualización personalizada.
<! DOCTYPE html> <Html lang = "es"> <Head> <Charset Meta = "UTF-8"> <Título> jQuery UI barra de progreso (ProgressBar) - pestaña personalizada </ title> <Link rel = "stylesheet" href = "// code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <Script src = "// code.jquery.com/jquery-1.9.1.js"> </ script> <Script src = "// code.jquery.com/ui/1.10.4/jquery-ui.js"> </ script> <Link rel = "stylesheet" href = "http://jqueryui.com/resources/demos/style.css"> <Style> .ui-progressbar { position: relative; } .progress-label { position: absolute; izquierda: 50%; superior: 4 píxeles; font-weight: bold; text-shadow: 1px 1px 0 #fff; } </ Style> <Script> $ (Function () { var progressbar = $ ( "#progressbar"), progressLabel = $ ( ".progress etiqueta"); progressbar.progressbar ({ Valor: true, cambiar: function () { progressLabel.text (progressbar.progressbar ( "valor") + "%"); }, completar: function () { progressLabel.text ( "Complete!"); } }); progreso function () { var = val progressbar.progressbar ( "valor") || 0; progressbar.progressbar ( "valor", val + 1); si (val <99) { setTimeout (progreso, 100); } } setTimeout (progreso, 3000); }); </ Script> </ Head> <Cuerpo> <Div id = "progressbar"> <div class = "etiqueta progreso"> Cargando ... </ div> </ div> </ Body> </ Html>
valor indeterminado
barra de progreso indeterminada, y puede cambiar entre cierta e incierta estilo.
<! DOCTYPE html> <Html lang = "es"> <Head> <Charset Meta = "UTF-8"> <Título> jQuery UI barra de progreso (ProgressBar) - valor indeterminado </ title> <Link rel = "stylesheet" href = "// code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <Script src = "// code.jquery.com/jquery-1.9.1.js"> </ script> <Script src = "// code.jquery.com/ui/1.10.4/jquery-ui.js"> </ script> <Link rel = "stylesheet" href = "http://jqueryui.com/resources/demos/style.css"> <Script> $ (Function () { $ ( "#progressbar") .progressbar ({ Valor: false }); $ ( "Botón") .en ( "clic", function (event) { objetivo var = $ (event.target), progressbar = $ ( "#progressbar"), progressbarValue = progressbar.find ( ".ui-progressbar-valor"); si (target.is ( "#numButton")) { progressbar.progressbar ( "opción", { Valor: Math.floor (Math.random () * 100) }); } Else if (target.is ( "#colorButton")) { progressbarValue.css ({ "Fondo": '#' + Math.floor (Math.random () * 16777215) .toString (16) }); } Else if (target.is ( "#falseButton")) { progressbar.progressbar ( "opción", "valor", false); } }); }); </ Script> <Style> #progressbar .ui-progressbar valor { background-color: #ccc; } </ Style> </ Head> <Cuerpo> <Div id = "progressbar"> </ div> <Botón id = "NumButton"> valor aleatorio - Aceptar </ botón> <Botón id = "falseButton"> seguro </ botón> <Botón id = ""> ColorButton colores al azar </ botón> </ Body> </ Html>