Table of Contents
回复讨论(解决方案)
Home Web Front-end HTML Tutorial The html progress bar changes with the playback progress, and pause and start buttons are added. _html/css_WEB-ITnose

The html progress bar changes with the playback progress, and pause and start buttons are added. _html/css_WEB-ITnose

Jun 24, 2016 am 11:39 AM





Xinda Electromagnetic Environment Monitoring Platform





 




Frequency change progress:




div style="width: 2%;">
        33%
    




返回下载CSS进度条



    
        

            

            

            

            

            

        
    


回复讨论(解决方案)

进度条的原理就是计算下 当前加载资源的个数与总的资源的个数的比值,来设置div的长度 比如说 总共有5个div 加载了四个
进度条就是80%的长度




然后写个函数通过 "当前加载资源的个数与总的资源的个数的比值"来控制id为progress的div的长度,实现的效果就是进度条的效果。
代码是随手写的,

我改了好多遍,可每次改动的时候我的图就没有动态效果啦,因为我是初学者但是急用代码,所以能不能帮我改下源代码,谢谢您了

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>信大电磁环境监测平台</title><style>body {    font-size: 12px;}#n {    margin: 10px auto;    width: 920px;    border: 1px solid #CCC;    font-size: 14px;    line-height: 30px;}#n a {    padding: 0 4px;    color: #333}.Bar,.Bars {    position: relative;    width: 200px; /* 宽度 */    border: 1px solid #B1D632;    padding: 1px;}.Bar div,.Bars div {    display: block;    position: relative;    background: #00F; /* 进度条背景颜色 */    color: #333333;    height: 20px; /* 高度 */    line-height: 20px; /* 必须和高度一致,文本才能垂直居中 */}.Bars div {    background: #090}.Bar div span,.Bars div span {    position: absolute;    width: 200px; /* 宽度 */    text-align: center;    font-weight: bold;}.cent {    margin: 0 auto;    width: 300px;    overflow: hidden}#status>div:not(:nth-of-type(1)){    display: none;}#btns{    text-align: center;}</style></head><body>    <p> </p>    <div class="cent">        <p>频率变化进度:</p>        <p>            <div class="Bars">                <div style="width: 0%;">                    <span></span>                </div>            </div>        </p>    </div>    <p id="btns">    <button onclick="stop(timer)">stop</button>    <button onclick="start('show();', delay);">start</button>    </p>    <p>        返回下载<a href="http://www.divcss5.com/template/m411.shtml">CSS进度条</a>    </p></body><body>    <div id="status">        <div>            <img src="http://chuantu.biz/t2/11/1438825741x-954497768.png" />        </div>        <div>            <img src="http://chuantu.biz/t2/11/1438825765x-954497768.png" />        </div>        <div>            <img src="http://chuantu.biz/t2/11/1438825794x-954497768.png" />        </div>        <div>            <img src="http://chuantu.biz/t2/11/1438825813x-954497768.png" />        </div>        <div>            <img src="http://chuantu.biz/t2/11/1438825832x-954497768.png" />        </div>    </div></body></html><script src="http://code.jquery.com/jquery-latest.min.js"></script><script>var current = 1;var delay = 1000;var timer;timer = start("show();", delay);function start(cod, delay){    return timer = setInterval(cod, delay);}function stop(timer) {    timer = clearInterval(timer);};function show(){    var len = $('#status>div').length;    $('#status>div:nth-of-type('+current+')').css('display', 'none');    current = current % len + 1;    $('#status>div:nth-of-type('+current+')').css('display', 'block');    $('.Bars>div>span').html(Math.round(current * 100 / len) + '%');    $('.Bars>div').css('width', Math.round(current * 100 / len) + '%');}</script>
Copy after login

非常感谢上面的两位仁兄给我指导,都给我编写了代码,让我如愿实现了功能。

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

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)

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

What is the viewport meta tag? Why is it important for responsive design? What is the viewport meta tag? Why is it important for responsive design? Mar 20, 2025 pm 05:56 PM

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

What is the purpose of the <iframe> tag? What are the security considerations when using it? What is the purpose of the <iframe> tag? What are the security considerations when using it? Mar 20, 2025 pm 06:05 PM

The article discusses the &lt;iframe&gt; tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

See all articles