angularjs结合bootstrap--进度条progressBar

angularjs结合bootstrap–进度条progressBar

<!DOCTYPE html>
<html lang="en" ng-app="ngShowcaseApp">
<head>
    <meta charset="UTF-8">
    <title>progressBar</title>
    <link rel="stylesheet" href="bootstrap.min.css">

</head>
<body ng-controller="ctrl">
    <div ng-class="{progress: true, 'progress-striped': vm.striped}">
        <div ng-class="['progress-bar', vm.style]" ng-style="{width: vm.value + '%'}">
            <div ng-if="vm.showLabel">{{vm.value}}%</div>
        </div>
    </div>

    <h3>选项</h3>
    <label>进度:<input type="number" class="form-control" ng-model="vm.value"/></label>
    <button class="btn btn-primary" ng-click="vm.value=0">0%</button>
    <button class="btn btn-primary" ng-click="vm.value=20">20%</button>
    <button class="btn btn-primary" ng-click="vm.value=60">60%</button>
    <button class="btn btn-primary" ng-click="vm.value=100">100%</button>
    <hr/>
    <label>斑马纹<input type="checkbox"  ng-model="vm.striped"/></label>
    <label>文字<input type="checkbox" ng-model="vm.showLabel"/></label>
    <hr/>
    <label>风格:
        <select ng-model="vm.style" class="form-control">
            <option value="progress-bar-success">progress-bar-success</option>
            <option value="progress-bar-info">progress-bar-info</option>
            <option value="progress-bar-danger">progress-bar-danger</option>
            <option value="progress-bar-warning">progress-bar-warning</option>
        </select>
    </label>
</body>
<script src="angular.js"></script>
<script >
    'use strict';

    angular.module('ngShowcaseApp',[]).controller('ctrl', function ($scope) {
        var vm = $scope.vm = {};
        vm.value = 50;
        vm.style = 'progress-bar-info';
        vm.showLabel = true;
        vm.striped = true;
    });
</script>
</html>

运行结果:

Bootstrap Progressbar 是一个 jQuery 插件,扩展了基本引导进度。它通过添加 Javascript 中预先存在的 CSS 转换提供了动态进度条。此外,你可以在动态进度条中通过回调显示当前进度信息。代码示例:default valuesProgressbar.defaults = {     transition_delay: 300,     refresh_speed: 50,     display_text: 'none',     use_percentage: true,    percent_format: function(percent) { return percent   '%'; },    amount_format: function(amount_part, amount_total) { return amount_part   ' / '   amount_total; },     update: $.noop,     done: $.noop,     fail: $.noop };transition_delay$(document).ready(function() {     $('.progress .progress-bar').progressbar({         transition_delay: 1500     }); });animationhorizontalless.progress .bar {     .transition(width 2s ease-in-out); }scss.progress.vertical .progress-bar {     @include transition(width 2s ease-in-out); }css.progress .bar {     -webkit-transition: width 2s ease-in-out;     -moz-transition: width 2s ease-in-out;     -ms-transition: width 2s ease-in-out;     -o-transition: width 2s ease-in-out;     transition: width 2s ease-in-out; }verticalless.progress.vertical .bar {     .transition(height 2s ease-in-out); }scss.progress.vertical .bar {     @include transition(height 2s ease-in-out); }css.progress.vertical .bar {     -webkit-transition: height 2s ease-in-out;     -moz-transition: height 2s ease-in-out;     -ms-transition: height 2s ease-in-out;     -o-transition: height 2s ease-in-out;     transition: height 2s ease-in-out; } 标签:Bootstrap
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值