繁体   English   中英

手机无法导入HTML

[英]mobile cannot import HTML

我曾经想以一种HTML格式导入HTML页面。

最后,我努力! chrome,firefox,opera可以将其导入桌面。

第一种方式

但是Safari也会出现问题,它无法在移动设备上运行,所有浏览器都无法加载。

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>    
<script> 
    $(function(){
      $("#1").load("section/1.html");
      $("#2").load("section/2.html"); 
      $("#3").load("section/3.html"); 
      $("#4").load("section/4.html");  
    });
</script> 

<section><div id="1"></div></script>
<section><div id="2"></div></script>
<section><div id="3"></div></script>
<section><div id="4"></div></script>

----------第二种方式

通过angular.min.js,该版本可以在移动设备和台式机上使用Chrome,但Safari无法使用。 加载第一部分时出错,不知道为什么...

<div ng-app="">
<section ng-include="'1.html'" data-0="transform: translateX(300px);" data-300="transform: translateY(0px)></section>
<section ng-include="'2.html'"></section>
<section ng-include="'3.html'"></section>
<section ng-include="'4.html'"></section>
</div>

在过去(HTML4)中,'id'属性需要以字母开头。 HTML5中取消了该限制。

Safari移动版可能存在兼容性问题。

更改“ id”属性以字母开头,然后查看是否有帮助。

您的脚本可以在加载目标html标记之前执行。 将整个加载过程添加到document.ready()回调中。

$(document).ready(function(){
   $("#1").load("section/1.html");
   $("#2").load("section/2.html"); 
   $("#3").load("section/3.html"); 
   $("#4").load("section/4.html"); 
});

同样在您的示例中,您对html的打开/关闭标签感到困惑

Anyway way By angular.min.js this one works
<div ng-app="">
    <section ng-include="'1.html'" data-0="transform: translateX(300px);" data-300="transform: translateY(0px)></section>
    <section ng-include="'2.html'"></section>
    <section ng-include="'3.html'"></section>
    <section ng-include="'4.html'"></section>
    </div>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM