>>分享Web前端开发技术,并对孙卫琴的《精通Vue.js:Web前端开发技术详解》提供技术支持 书籍支持  卫琴直播  品书摘要  在线测试  资源下载  联系我们
发表一个新主题 开启一个新投票 回复文章 您是本文章第 26072 个阅读者 刷新本主题
 * 贴子主题:  jQuery UI范例: 进度条(Progressbar) 回复文章 点赞(0)  收藏  
作者:flybird    发表时间:2019-08-18 12:30:07     消息  查看  搜索  好友  邮件  复制  引用

  

jQuery UI 范例 -  进度条(Progressbar)

    显示一个确定的或不确定的进程状态。                    

默认功能

     默认的确定的进度条。


<!doctype html>

<html lang="en">

<head>

  <meta charset="utf-8">

  <title>jQuery UI 进度条(Progressbar) - 默认功能</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({

      value: 37

    });

  });

  </script>

</head>

<body>

         <div id="progressbar"></div>

</body>

</html>

自定义标签

     自定义更新的标签。


<!doctype html>

<html lang="en">

<head>

  <meta charset="utf-8">

  <title>jQuery UI 进度条(Progressbar) - 自定义标签</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({

      value: false,

      change: function() {

        progressLabel.text( progressbar.progressbar( "value" ) + "%" );

      },

      complete: function() {

        progressLabel.text( "完成!" );

      }

    });

    function progress() {

      var val = progressbar.progressbar( "value" ) || 0;

               progressbar.progressbar( "value", val + 1 );

               if ( val < 99 ) {

        setTimeout( progress, 100 );

      }

    }

             setTimeout( progress, 3000 );

  });

  </script>

</head>

<body>

         <div id="progressbar"><div class="progress-label">加载...</div></div>

</body>

</html>

不确定的值

     不确定的进度条,并可在确定和不确定的样式之间切换。


<!doctype html>

<html lang="en">

<head>

  <meta charset="utf-8">

  <title>jQuery UI 进度条(Progressbar) - 不确定的值</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({

      value: false

    });

    $( "button" ).on( "click", function( event ) {

      var target = $( event.target ),

        progressbar = $( "#progressbar" ),

        progressbarValue = progressbar.find( ".ui-progressbar-value" );

      if ( target.is( "#numButton" ) ) {

        progressbar.progressbar( "option", {

          value: Math.floor( Math.random() * 100 )

        });

      } else if ( target.is( "#colorButton" ) ) {

        progressbarValue.css({

          "background": '#' + Math.floor( Math.random() * 16777215 ).toString( 16 )

        });

      } else if ( target.is( "#falseButton" ) ) {

        progressbar.progressbar( "option", "value", false );

      }

    });

  });

  </script>

  <style>

  #progressbar .ui-progressbar-value {

    background-color: #ccc;

  }

  </style>

</head>

<body>

         <div id="progressbar"></div>

<button id="numButton">随机值 - 确定</button>

<button id="falseButton">不确定</button>

<button id="colorButton">随机颜色</button>

</body>

</html>

程序猿的技术大观园:www.javathinker.net



[这个贴子最后由 flybird 在 2020-02-16 09:47:54 重新编辑]
  Java面向对象编程-->接口
  JavaWeb开发-->使用Session(Ⅰ)
  JSP与Hibernate开发-->映射对象标识符
  Java网络编程-->用Swing组件展示HTML文档
  精通Spring-->
  Vue3开发-->虚拟DOM和render()函数
  前端Vue单页面应用性能优化
  10个开发者经常问的JavaScript面试题(附答案解析)
  vue30道面试题
  Vue选项的用法
  加快 Vue 项目的开发速度
  前端面试题及答案汇总
  vue+file-saver+jszip实现批量导出图片
  JavaScript中数组的常用方法(含ES6)
  JavaScript 进制转换的实用代码
  JavaScript的HTML DOM Track 对象
  HTML DOM Image图片对象
  jQuery UI 范例 - 选择条目(Selectable)
  CSS3 多列布局
  JavaScript 的字符串以及处理方法
  jQuery Mobile 事件
  更多...
 IPIP: 已设置保密
楼主      
1页 0条记录 当前第1
发表一个新主题 开启一个新投票 回复文章


中文版权所有: JavaThinker技术网站 Copyright 2016-2026 沪ICP备16029593号-2
荟萃Java程序员智慧的结晶,分享交流Java前沿技术。  联系我们
如有技术文章涉及侵权,请与本站管理员联系。