Najlepszy samouczek jQuery UI przykład - pasek postępu (Progressbar) W 2024 r. W tym samouczku możesz dowiedzieć się Domyślną funkcją,Etykieta niestandardowa,wartość nieokreśloną,
Wyświetlanie pewien proces lub stan niepewności.
Więcej informacji na temat członka Progressbar można znaleźć w dokumentacji API członek pasek postępu (Progressbar Widget) .
Wartość domyślna jest określana pasek postępu.
<! DOCTYPE html> <Html lang = "pl"> <Head> <Meta charset = "utf-8"> <Title> jQuery UI pasek postępu (Progressbar) - Domyślna funkcja </ 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 ({ Wartość: 37 }); }); </ Script> </ Head> <Body> <Div id = "progressbar"> </ div> </ Body> </ Html>
Niestandardowe etykiety aktualizacji.
<! DOCTYPE html> <Html lang = "pl"> <Head> <Meta charset = "utf-8"> <Title> jQuery UI pasek postępu (Progressbar) - kartę niestandardową </ 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; left: 50%; top: 4px; font-weight: bold; text-shadow: 1px 1px 0 #fff; } </ Style> <Script> $ (Function () { var progressbar = $ ( "#progressbar"), progressLabel = $ ( ".progress-label"); progressbar.progressbar ({ wartość false, zmiany: function () { progressLabel.text (progressbar.progressbar ( "wartość") + "%"); } ukończenia: function () { progressLabel.text ( "Complete!"); } }); Postęp function () { var val = progressbar.progressbar ( "wartość") || 0; progressbar.progressbar ( "wartość", val + 1); if (val <99) { setTimeout (postęp, 100); } } setTimeout (postęp, 3000); }); </ Script> </ Head> <Body> <Div id = "progressbar"> <div class = "Postęp-label"> Ładowanie pl. </ div> </ div> </ Body> </ Html>
Nieokreślony pasek postępu, i może przełączać się pomiędzy pewnym i niepewne stylu.
<! DOCTYPE html> <Html lang = "pl"> <Head> <Meta charset = "utf-8"> <Title> jQuery UI pasek postępu (Progressbar) - wartość nieokreślona </ 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 ({ wartość false }); $ ( "Button") .Na ( "click", function (event) { target var = $ (event.target) progressbar = $ ( "#progressbar"), progressbarValue = progressbar.find ( ".ui-progressbar wartości"); if (target.is ( "#numButton")) { progressbar.progressbar ( "opcja", { wartość: Math.floor (Math.random () * 100) }); } Else if (target.is ( "#colorButton")) { progressbarValue.css ({ "Tło": '#' + Math.floor (Math.random () * 16777215) .ToString (16) }); } Else if (target.is ( "#falseButton")) { progressbar.progressbar ( "opcja", "wartość", false); } }); }); </ Script> <Style> #progressbar .ui-progressbar wartość { background-color: #ccc; } </ Style> </ Head> <Body> <Div id = "progressbar"> </ div> <Button id = "NumButton"> wartość losowa - OK </ button> <Button id = "falseButton"> Pewnie </ button> <Button id = ""> colorButton losowych kolorów </ button> </ Body> </ Html>