Javascript to jQuery help?

Javascript to jQuery help?

  1. window.onscroll = function() {
  2. progress()
  3. };

  4. function progress() {
  5.   var winScroll = document.body.scrollTop || document.documentElement.scrollTop;
  6.   var height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
  7.   var scrolled = (winScroll / height) * 100;
  8.   document.getElementById("myBar").style.width = scrolled + "%";
  9. }
I thought something like this might work :

  1. jQuery(document).ready(function($) {

  2. $(document).on( 'scroll', function() {

  3. if ( $(document).scrollTop() * 100 ) {

  4.  $( '#myBar' );

  5. });