Fix scrolling of content in iframes for touch devices (applied for iOS)

This commit is contained in:
Hadi Nategh 2014-10-23 13:45:11 +00:00
parent 8d8f89d171
commit 06372a3944

View File

@ -140,6 +140,7 @@ var AppJS = Class.extend(
egw.debug('log', "Changed et2 object"); egw.debug('log', "Changed et2 object");
} }
this.et2 = et2.widgetContainer; this.et2 = et2.widgetContainer;
this._fix_iFrameScrolling();
}, },
/** /**
@ -692,5 +693,32 @@ var AppJS = Class.extend(
"Delete", et2_dialog.YES_NO, et2_dialog.QUESTION_MESSAGE); "Delete", et2_dialog.YES_NO, et2_dialog.QUESTION_MESSAGE);
return false; 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);
}
});
}
} }
}); });