Loader widget halfway down the page using fakeFixLoader jqm 1.4.5 Solved

Loader widget halfway down the page using fakeFixLoader jqm 1.4.5 Solved

On older phones, the loader widget shows, but is half way down the page off the screen, you have to scroll down to see it.  It seems to calculate the screen position incorrectly.

fix  Add this to your "mobileinit" or (function($){..}(jQuery))
  1. $.mobile.loader.prototype.fakeFixLoader = function() {
        var activeBtn = $("." + $.mobile.activeBtnClass ).first(),
            scrollTop = this.window.scrollTop() || $("html").scrollTop() || $("body").scrollTop();
        this.element.css({top: $.support.scrollTop && scrollTop + $.mobile.getScreenHeight() / 2 ||
                      activeBtn.length && activeBtn.offset().top || 100 });
      };
      $.mobile.loader.prototype.checkLoaderPosition = function() {
        var offset = this.element.offset(),
            scrollTop = this.window.scrollTop() || $("html").scrollTop() || $("body").scrollTop(),
            screenHeight = $.mobile.getScreenHeight();
        if (offset.top < scrollTop || (offset.top - scrollTop) > screenHeight) {
          this.element.addClass("ui-loader-fakefix");
          this.fakeFixLoader();
         this.window.unbind("scroll",this.checkLoaderPosition)
  2.           .bind("scroll",$.proxy(this.fakeFixLoader,this));
        }
      };

changes are:
scrollTop = this.window.scrollTop() || $("html").scrollTop() || $("body").scrollTop()

and

$.mobile.getScreenHeight() rather than this.window.height()

Answer to my own question, if anyone else is seeing this issue.  It has been bugging me for ages (especially on my favourite old phone).

Cheers