自定義刻度jQuery進(jìn)度條及插件
簡(jiǎn)要教程 progressdots是一款可自定義刻度動(dòng)畫(huà)的jQuery進(jìn)度條插件。通過(guò)該jQuery進(jìn)度條插件你可以自定義進(jìn)度條刻度圓點(diǎn)的數(shù)量,大小,顏色等屬性,并且可以通過(guò)CSS來(lái)控制圓點(diǎn)的外觀樣式。
請(qǐng)看下面效果圖了解相關(guān)插件。
使用該jQuery進(jìn)度條插件需要引入jquery,jquery.progressdots.js和jquery.progressdots.css文件。
<script src="jquery.min.js"></script> <script src="jquery.progressdots.js"></script> <link href="jquery.progressdots.css" rel="stylesheet">
HTML結(jié)構(gòu)
然后使用一個(gè)空的<div> 元素來(lái)作為進(jìn)度條的容器。
容器的寬度和高度任意。
<div id='progressBox'></div>
為進(jìn)度條容器設(shè)置一些基本樣式,指定它的寬度和高度。
#progressBox{ border: 8px solid #DDD; width: 80%; height: 40px; }
調(diào)用插件
在頁(yè)面DOM元素加載完畢之后,可以通過(guò)下面的方法來(lái)初始化該進(jìn)度條插件
$( '#progressBox' ).dottify({ dotSize: '25px', //set size of dot dotColor: '#f15c89', //set dot color (#HEX) progress: true, //enable progress percent: 10, //set initial percentage radius: '40%' //set dot corner radius });
高級(jí)選項(xiàng)
var progressBox = $( '#progressBox' ).dottify({ progress:true, //start with progressbar on percent:0 }); progressBox.setProgress( 20 ); //update progress percentage
可自定義刻度jQuery進(jìn)度條是一款可以自定義進(jìn)度條刻度圓點(diǎn)的數(shù)量,大小,顏色等屬性,并且可以通過(guò)CSS來(lái)控制圓點(diǎn)的外觀樣式。
效果圖如下:
html代碼:
<div class="htmleaf-container"> <div id="container"> <div class="padded"> <div id="progressHolder"></div> <div id="progressReset">生成隨機(jī)的風(fēng)格</div> </div> </div> </div> <script src="js/jquery-2.1.1.min.js" type="text/javascript"></script> <script src="js/jquery.progressdots.js"></script> <script src="js/prism.js"></script> <script> $(document).ready(function () { createSpots(1); $("#progressReset").click(function (event) { event.preventDefault(); createSpots(1); }); function createSpots(num) { for (var i = 0; i < num; i++) { options = { dotSize: random(10, 20) + "px", radius: random(1, 7) * 10 + "%" }; randomHtml = ""; if (Math.random() < 0.5) { options.randomColors = true; randomHtml += "\n\trandomColors: " + options.randomColors + ", //use random colors"; } else { options.dotColor = randomColor(); randomHtml += "\n\tdotColor: '" + options.dotColor + "', //set dot color (#HEX)"; } if (Math.random() < 0.3) { options.progress = true; options.percent = random(5, 100); randomHtml += "\n\tprogress: true, //enable progress"; randomHtml += "\n\tpercent: " + options.percent + ", //set initial percentage"; } else { options.numDots = random(3, 15); randomHtml += "\n\tnumDots: " + options.numDots + ", //number of dots"; } string = "$( '#progressBox' ).dottify({\ \n\tdotSize: '" + options.dotSize + "', //set size of dot" + randomHtml + "\n\tradius: '" + options.radius + "' //set dot corner radius\ \n});"; var $container = $("<div class='swoopContainer'></div>").data("setupString", JSON.stringify(string)); $("#progressHolder").append($container.hide()); $container.slideDown(function () { $(this).css({ overflow: "hidden" }); }); $container.click(function () { $(".swoopContainer").removeClass("selected"); $(this).addClass("selected"); $("#jsContents").html(JSON.parse($(this).data("setupString"))); Prism.highlightAll(); }); $container.dottify(options); $("#jsContents").html(string); Prism.highlightAll(); } $(".swoopContainer").removeClass("selected"); $(".swoopContainer").last().addClass("selected"); } function randomColor() { return '#' + Math.floor(Math.random() * 16777215).toString(16); } function random(min, max) { return Math.floor(Math.random() * ((max - min) + min) + min); } }); </script>
- jQuery簡(jiǎn)單實(shí)現(xiàn)提交數(shù)據(jù)出現(xiàn)loading進(jìn)度條的方法
- 基于HTML5 Ajax文件上傳進(jìn)度條如何實(shí)現(xiàn)(jquery版本)
- jquery實(shí)現(xiàn)模擬百分比進(jìn)度條漸變效果代碼
- 利用jQuery實(shí)現(xiàn)漂亮的圓形進(jìn)度條倒計(jì)時(shí)插件
- 6款新穎的jQuery和CSS3進(jìn)度條插件推薦
- 分享8款優(yōu)秀的 jQuery 加載動(dòng)畫(huà)和進(jìn)度條插件
- 用jQuery模擬頁(yè)面加載進(jìn)度條的實(shí)現(xiàn)代碼
- jQuery EasyUI API 中文文檔 - ProgressBar 進(jìn)度條
- html、css和jquery相結(jié)合實(shí)現(xiàn)簡(jiǎn)單的進(jìn)度條效果實(shí)例代碼
相關(guān)文章
jquery實(shí)現(xiàn)的偽分頁(yè)效果代碼
這篇文章主要介紹了jquery實(shí)現(xiàn)的偽分頁(yè)效果代碼,涉及jQuery頁(yè)面元素操作與數(shù)值計(jì)算的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-10-10jQuery代碼實(shí)現(xiàn)發(fā)展歷程時(shí)間軸特效
這篇文章主要介紹了jQuery代碼實(shí)現(xiàn)發(fā)展歷程時(shí)間軸特效代碼,帶有左右箭頭,數(shù)字時(shí)間軸選項(xiàng)卡切換特效,有需要的小伙伴們可以來(lái)參考下2015-07-07基于jquery 的一個(gè)progressbar widge
這個(gè)widget是包含在wijmo 項(xiàng)目中的一個(gè)widget。目前此widget已經(jīng)開(kāi)源基于mit和gpl雙協(xié)議,目前是beta版,可能存在bug。2010-10-10基于Jquery的動(dòng)態(tài)添加控件并取值的實(shí)現(xiàn)代碼
基于Jquery的動(dòng)態(tài)添加控件并取值的實(shí)現(xiàn)代碼,需要的朋友可以參考下。2010-09-09Jquery遍歷select option和添加移除option的實(shí)現(xiàn)方法
下面小編就為大家?guī)?lái)一篇Jquery遍歷select option和添加移除option的實(shí)現(xiàn)方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-08-08jquery easyui DataGrid簡(jiǎn)單示例
本篇文章主要介紹了jquery easyui DataGrid簡(jiǎn)單示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-01-01