>>分享Web前端开发技术,并对孙卫琴的《精通Vue.js:Web前端开发技术详解》提供技术支持 书籍支持  卫琴直播  品书摘要  在线测试  资源下载  联系我们
发表一个新主题 开启一个新投票 回复文章 您是本文章第 26952 个阅读者 刷新本主题
 * 贴子主题:  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开发-->Web运作原理(Ⅱ)
  JSP与Hibernate开发-->数据库事务的并发问题的解决方案
  Java网络编程-->客户端协议处理框架
  精通Spring-->绑定CSS样式
  Vue3开发-->Vue CLI脚手架工具
  Vue CLI项目的package.json中版本号详解~和^和*的区别
  Vue项目PWA化
  CSS的style样式的三种用法
  Vue用法详解
  Vue路由开启keep-alive时的注意点
  Vue的使用方法
  js导出json文件
  jQuery 获取并设置 CSS 类
  jQuery 添加元素
  JavaScript中的HTML DOM Button 对象
  CSS 属性选择器
  HTML5 播放Audio(音频)
  JavaScript编程规范
  JavaScript 的字符串以及处理方法
  JavaScript 语法大全
  更多...
 IPIP: 已设置保密
楼主      
1页 0条记录 当前第1
发表一个新主题 开启一个新投票 回复文章


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