利用jquery和BootStrap实现动态滚动条效果

2020-05-17 06:23:48易采站长站整理

self.setContainer = function(_container) {
container = _container;
}

//为当前容器加入progress
self.createProgressBar = function() {
container.append('<div class="progress" id="'+ _id +'"><div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"><span class="proText"></span></div></div>');
}

self.beginProcessBar = function() {
var i = 0;
interval = setInterval(function() {
i += 10;
if(i <= 90) {
$("#" + _id + " .progress-bar").css({"width":i + "%"});
$("#" + _id + " .proText").text(i + '%');
}
}, 1000);
}

self.showProcessBar = function() {
self.createProgressBar();
self.beginProcessBar();
}

self.finishProcessBar = function() {
if(interval != null) {
$("#" + _id + " .progress-bar").css({"width": "100%"});
$("#" + _id + " .proText").text('100%');
clearInterval(interval);
}
}

self.destroyProcessBar = function() {
$("#" + _id).remove();
}

return self;
}

</script>
</body>
</html>

总结

以上所述是小编给大家介绍的利用jquery和BootStrap实现动态滚动条效果,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对软件开发网网站的支持!