/*jshint browser: true */
(function () {
    "use strict";

    var root = this,
        $ = root.jQuery,
        body = $('body');

    if (typeof GOVUK === 'undefined') { root.GOVUK = {}; }

    var StickyHeader = function(element) {
        this.top = $(element).offset().top - 30;
        this.addEventHandlers();
    };
    
    StickyHeader.prototype.addEventHandlers = function () {
        this.windowScrollHandler = this.getWindowScrollEventHandler();
        window.onscroll = this.windowScrollHandler;
    };
    StickyHeader.prototype.getWindowScrollEventHandler = function () {
        return function (e) {
            this.handleWindowScroll($(e.target));
        }.bind(this);
    };
    StickyHeader.prototype.handleWindowScroll = function () {
        if (window.pageYOffset >= this.top) {
            body.addClass('fixed');
        } else {
            body.removeClass('fixed');
        }
    };

    root.GOVUK.StickyHeader = StickyHeader;

}).call(this);

@@ -52,16 +52,20 @@
 trict%22;%0A
+    
 %0A    var
@@ -127,16 +127,132 @@
 ('body')
+,%0A        mobileSafari = navigator.userAgent.match(/(iPod%7CiPhone%7CiPad)/) && navigator.userAgent.match(/AppleWebKit/)
 ;%0A%0A    i
@@ -345,24 +345,59 @@
 (element) %7B%0A
+        this.wrapper = $(element);%0A
         this
@@ -621,25 +621,43 @@
     
-window.on
+document.addEventListener(%22
 scroll
- =
+%22,
  thi
@@ -677,16 +677,24 @@
 lHandler
+, false)
 ;%0A    %7D;
@@ -866,32 +866,37 @@
 d(this);%0A    %7D;%0A
+    %0A
     StickyHeader
@@ -1035,55 +1035,561 @@
     
-%7D else %7B%0A            body.removeClass('fixed');
+    %0A            // Mobile safari hides fixed elements when the keyboard is shown so use%0A            // absolute instead.%0A            if (mobileSafari) %7B%0A                this.wrapper.css(%7B%0A                    position: 'absolute',%0A                    top: window.pageYOffset + 'px',%0A                    left: 0%0A                %7D);%0A            %7D%0A            %0A        %7D else %7B%0A            body.removeClass('fixed');%0A            if (mobileSafari) %7B%0A                this.wrapper.css(%7B%0A                    position: 'static'%0A                %7D);%0A            %7D
 %0A   

Fix issue with Safari on IOS which caused the title to be hidden when entering data.