[英]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.