Guest User

Untitled

a guest
Jul 17th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <div class="progress">
  2. <div class="progress-bar progress-bar-striped" role="progressbar" style="width: 0" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"></div>
  3. </div>
  4.  
  5. $(".progress-bar").each(function () {
  6. $(this).animate( {width: $(this).attr('aria-valuenow') + '%' }, 2000 );
  7. });
  8.  
  9. $(window).scroll( function(){
  10.  
  11. $(".progress-bar").each(function () {
  12. var bottom_of_object = $(this).position().top + $(this).outerHeight();
  13. var bottom_of_window = $(window).scrollTop() + $(window).height();
  14. if( bottom_of_window > bottom_of_object ){
  15. $(this).animate( {width: $(this).attr('aria-valuenow') + '%' }, 2000 );
  16. }
  17. });
  18. });
Add Comment
Please, Sign In to add comment