From fed76559fad63c339408402cc53c6f408c989f31 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 23 Oct 2014 13:44:40 +0000 Subject: [PATCH] Fix scrolling of content in iframes for touch devices (applied for iOS) --- phpgwapi/js/jsapi/app_base.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/phpgwapi/js/jsapi/app_base.js b/phpgwapi/js/jsapi/app_base.js index 007a2e8610..a343f31da7 100644 --- a/phpgwapi/js/jsapi/app_base.js +++ b/phpgwapi/js/jsapi/app_base.js @@ -140,6 +140,7 @@ var AppJS = Class.extend( egw.debug('log', "Changed et2 object"); } this.et2 = et2.widgetContainer; + this._fix_iFrameScrolling(); }, /** @@ -692,5 +693,32 @@ var AppJS = Class.extend( "Delete", et2_dialog.YES_NO, et2_dialog.QUESTION_MESSAGE); return false; + }, + + /** + * Fix scrolling iframe browsed by iPhone/iPod/iPad touch devices + */ + _fix_iFrameScrolling: function() + { + if (/iPhone|iPod|iPad/.test(navigator.userAgent)) + { + jQuery("iframe").on({ + load: function() + { + var body = this.contentWindow.document.body; + + var div = jQuery(document.createElement("div")) + .css ({ + 'height' : jQuery(this.parentNode).height(), + 'width' : jQuery(this.parentNode).width(), + 'overflow' : 'scroll'}); + while (body.firstChild) + { + div.append(body.firstChild); + } + jQuery(body).append(div); + } + }); + } } });