window.onload=function() { var element = document.getElementById("myBar"); var width = 1; var identity = setInterval(scene, 10); function scene() { if (width >= 100) { clearInterval(identity); } else { width++; element.style.width = width + '%'; } } } $(document).ready(function(){ $('#slider').bxSlider({ auto: true, controls: true, infiniteLoop: true, mode: 'horizontal', autoDirection: 'next', responsive: true, preloadImages: 'all', autoDelay: 0, randomStart: false, pager: false, moveSlideQty: 1, useCSS: false, speed: 750, hideControlOnEnd: true, slideSelector: 'div.item', minSlides: 3, maxSlides: 3, moveSlides: 1, slideWidth: 1000, nextSelector: '#slider-next', prevSelector: '#slider-prev', nextText: '', prevText: '' }); });