我使用AngularJS,Jquery,HTML5将网站嵌入到DOM元素中。请参阅以下代码:
digibin_app.directive("displayFile", function () {
var updateElem = function (element) {
return function (displayFile) {
element.empty();
var objectElem = {}
if (displayFile && displayFile.type !== "") {
if (displayFile.type === "pdf") {
objectElem = angular.element(document.createElement("object"));
objectElem.attr("data", displayFile.fileUrl);
objectElem.attr("type", "application/pdf");
}
else if (displayFile.type === "html" ) {
objectElem = angular.element(document.createElement("object"));
var childHeight = parseInt(window.innerHeight);
// problem is here in below line
objectElem.attr("style", "width:100%;height:"+childHeight+"px;margin:0px;");
objectElem.attr("data", displayFile.fileUrl);
objectElem.attr("type", "text/html");
}
else {
objectElem = angular.element(document.createElement("img"));
objectElem.attr("src", displayFile.fileUrl);
}
}
element.append(objectElem);
};
};
return {
restrict: "EA",
scope: {
displayFile: "="
},
link: function (scope, element, attrs) {
scope.$watch("displayFile", updateElem(element));
}
};
});
一切都来了精美的数据,页面渲染,功能等等。只有困扰我的是,对于长页面,它不会在IPHONE 5S上显示滚动条。在Android上它的工作绝对精细。
请帮助我。任何帮助将受到高度赞赏。