曲线图例子,十行HTML完结增进现实

十行HTML完成拉长现实

2017/06/11 · HTML5 · 1
评论

本文由 伯乐在线 –
一杯哈希不加盐
翻译,艾凌风
校稿。未经许可,禁止转发!
英文出处:Alexandra
Etienne。欢迎参加翻译组。

你想经过网络完毕做完毕实吧?现在您只须求 10 行 HTML
代码!真的!让自己带您看一看代码,格外简单。

咱俩近年来发表了AR.js。你不要求设置任何利用,用你的无绳电话机通过网络就能感受到无敌的增高现实。但让我们更进一步,看一下哪些让你也撰写出团结的增进现实感受。多亏了神奇的a-frame,最短的
AR.js 只有 10 行 HTML
代码。你可以在codepen来看在线版:

XHTML

<!– Augmented Reality on the Web in 10 lines of html!
–> <script
src=”;
<script
src=”;
<script>THREEx.ArToolkitContext.baseURL =
‘;
<body style=’margin : 0px; overflow: hidden;’> <a-scene
embedded artoolkit=’sourceType: webcam;’> <a-box position=’0 0.5
0′ material=’opacity: 0.5;’></a-box> <a-marker-camera
preset=’hiro’></a-marker-camera> </a-scene> </body>

1
2
3
4
5
6
7
8
9
10
<!– Augmented Reality on the Web in 10 lines of html! https://github.com/jeromeetienne/ar.js –>
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
<script src="https://rawgit.com/jeromeetienne/ar.js/master/aframe/build/aframe-ar.js"></script>
<script>THREEx.ArToolkitContext.baseURL = ‘https://rawgit.com/jeromeetienne/ar.js/master/three.js/'</script>
<body style=’margin : 0px; overflow: hidden;’>
    <a-scene embedded artoolkit=’sourceType: webcam;’>
        <a-box position=’0 0.5 0′ material=’opacity: 0.5;’></a-box>
        <a-marker-camera preset=’hiro’></a-marker-camera>
    </a-scene>
</body>

俺们来一行一行看.

您想通过网络已毕拉长现实吗?现在你只须要 10 行 HTML
代码!真的!让我带您看一看代码,相当简单。

第三章 jQuery中的DOM操作,jquerydom

  DOM(Document Object
Model)文档对象模型,每张网页都能用DOM表示出来,每一份DOM都能作为一颗DOM树。

  jQuery继承了JavaScript对DOM对象操作的性状,使开发人士能有益地操作DOM对象。

  1.查找节点

澳门葡京 1<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ /> <title>3-1</title>
<!– 引入jQuery –> <script src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function () { var $para =
$(“p”); // 获取<p>节点 var p_txt = $para.attr(“title”); //
获取<p>元素节点属性title alert(p_txt); var $li = $(“ul
li:eq(1)”); // 获取第四个<li>元素节点 var ul_txt =
$li.attr(“title”); //
获取<ul>里的第一个<li>元素节点的特性title var li_txt =
$li.text(); // 获取第四个<li>元素节点的text alert(ul_txt);
alert(li_txt); }); //]]> </script> </head>
<body> <p title=”选用你最欢愉的水果.”
>你最高兴的瓜果是?</p> <ul> <li
title=’苹果’>苹果</li> <li title=’橘子’>橘子</li>
<li title=’菠萝’>菠萝</li> </ul> </body>
</html> View Code

  2.创建节点

澳门葡京 2<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-2-1</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $li_1 =
$(“<li></li>”); // 创设第二个<li>元素 var $li_2 =
$(“<li></li>”); // 创造第四个<li>元素 var $parent =
$(“ul”); // 获取<ul>节点,<li>的父节点
$parent.append($li_1); // 添加到<ul>节点中,使之能在网页中浮现$parent.append($li_2); //
可以接纳链式写法:$parent.append($li_1).append($li_2); }); //]]>
</script> </head> <body> <p
title=”选取你最喜爱的水果.” >你最欢悦的瓜果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
澳门葡京 3<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-2-2</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $li_1 =
$(“<li>香蕉</li>”); //
创立一个<li>元素,包含元素节点和文件节点
//“香蕉”就是创设的公文节点。 var $li_2 =
$(“<li>雪梨</li>”); //
创制一个<li>元素,包含元素节点和文书节点
//“雪梨”就是创造的文本节点。 var $parent = $(“ul”); //
获取<ul>节点。<li>的父节点 $(“ul”).append($li_1); //
添加到<ul>节点中,使之能在网页中呈现 $(“ul”).append($li_2); //
添加到<ul>节点中,使之能在网页中显得 }); //]]>
</script> </head> <body> <p
title=”选拔你最喜爱的水果.” >你最欢跃的鲜果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
澳门葡京 4<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-2-3</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $li_1 =
$(“<li title=’香蕉’>香蕉</li>”); //创设一个<li>元素
//包涵元素节点,文本节点和特性节点 //其中title=’香蕉’ 就是创造的特性节点
var $li_2 = $(“<li title=’雪梨’>雪梨</li>”);
//创立一个<li>元素 //包含元素节点,文本节点和特性节点
//其中title=’雪梨’ 就是开创的习性节点 var $parent = $(“ul”); //
获取<ul>节点。<li>的父节点 $parent.append($li_1); //
添加到<ul>节点中,使之能在网页中浮现 $parent.append($li_2); //
等价于:$parent.append($li_1).append($li_2); }); //]]>
</script> </head> <body> <p
title=”拔取你最喜爱的水果.” >你最兴奋的鲜果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  3.插入节点

澳门葡京 5<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-3-1</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $li_1 =
$(“<li title=’香蕉’>香蕉</li>”); // 成立第三个<li>元素
var $li_2 = $(“<li title=’雪梨’>雪梨</li>”); //
创制第三个<li>元素 var $li_3 = $(“<li
title=’此外’>其余</li>”); // 创设第多个<li>元素 var
$parent = $(“ul”); // 获取<ul>节点,即<li>的父节点 var
$two_li = $(“ul li:eq(1)”); //
获取<ul>节点中第四个<li>元素节点 $parent.append($li_1); //
append方法将开创的首先个<li>元素添加到父元素的尾声面
$parent.prepend($li_2); //
prepend方法将创立的首个<li>元素添加到父元素里的最前边$li_3.insertAfter($two_li); //
insertAfter方法将开创的第多少个<li>元素元素插入到收获的<li>之后
}); //]]> </script> </head> <body> <p
title=”选拔你最欣赏的水果.” >你最喜爱的水果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
澳门葡京 6<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-3-2</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $one_li =
$(“ul li:eq(1)”); // 获取<ul>节点中首个<li>元素节点 var
$two_li = $(“ul li:eq(2)”); //
获取<ul>节点中第一个<li>元素节点
$two_li.insertBefore($one_li); //移动节点 }); //]]>
</script> </head> <body> <p
title=”选拔你最喜爱的水果.” >你最喜爱的果品是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  4.剔除节点

澳门葡京 7<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-4-1</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ $(“ul
li:eq(1)”).remove(); //
获取第四个<li>元素节点后,将它从网页中除去。 }); //]]>
</script> </head> <body> <p
title=”拔取你最欣赏的水果.” >你最喜爱的果品是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
澳门葡京 8<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-4-2</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $li =
$(“ul li:eq(1)”).remove(); //
获取第三个<li>元素节点后,将它从网页中删去。 $li.appendTo(“ul”);
// 把刚刚去除的又重新添加到<ul>元素里
//所以,删除只是从网页中去除,在jQuery对象中,这几个因素如故存在的,大家可以另行赢得它
}); //]]> </script> </head> <body> <p
title=”选拔你最欣赏的水果.” >你最欣赏的瓜果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
澳门葡京 9<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-4-3</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ $(“ul
li”).remove(“li[title!=菠萝]”);
//把<li>元素中属性title不对等”菠萝”的<li>元素删除 });
//]]> </script> </head> <body> <p
title=”选取你最喜爱的水果.” >你最欢腾的水果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
澳门葡京 10<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-4-4</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ $(“ul
li:eq(1)”).empty(); //
找到第一个<li>元素节点后,清空此因素里的内容 }); //]]>
</script> </head> <body> <p
title=”拔取你最欢跃的水果.” >你最欣赏的瓜果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  5.复制节点

澳门葡京 11<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-5-1</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> $(function(){ $(“ul li”).click(function(){
$(this).clone().appendTo(“ul”); //
复制当前点击的节点,并将它追加到<ul>元素 }) }); </script>
</head> <body> <p title=”拔取你最喜爱的水果.”
>你最兴奋的鲜果是?</p> <ul> <li
title=’苹果’>苹果</li> <li title=’橘子’>橘子</li>
<li title=’菠萝’>菠萝</li> </ul> </body>
</html> View Code
澳门葡京 12<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-5-2</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> $(function(){ $(“ul li”).click(function(){
$(this).clone(true).appendTo(“ul”); // 注意参数true
//可以复制自己,并且他的副本也有同样听从。 }) }); </script>
</head> <body> <p title=”选拔你最欣赏的水果.”
>你最喜爱的果品是?</p> <ul> <li
title=’苹果’>苹果</li> <li title=’橘子’>橘子</li>
<li title=’菠萝’>菠萝</li> </ul> </body>
</html> View Code

  6.替换节点

澳门葡京 13<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ /> <title>3-6</title>
<!– 引入jQuery –> <script src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
$(“p”).replaceWith(“<strong>你最不欣赏的鲜果是?</strong>”);
// 同样的落到实处:
$(“<strong>你最不喜欢的果品是?</strong>”).replaceAll(“p”);
}); //]]> </script> </head> <body> <p
title=”选用你最喜爱的水果.” >你最欢快的鲜果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  7.包裹节点

澳门葡京 14<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-7-1</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
$(“strong”).wrap(“<b></b>”);//用<b>元素把<strong>元素包裹起来
}); //]]> </script> </head> <body> <strong
title=”拔取你最快乐的水果.” >你最欢乐的水果是?</strong>
<ul> <li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
澳门葡京 15<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-7-2</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
$(“strong”).wrap(“<b></b>”); }); //]]> </script>
</head> <body> <strong title=”选用你最喜爱的水果.”
>你最欢乐的鲜果是?</strong> <strong
title=”选用你最欣赏的水果.” >你最喜爱的水果是?</strong>
<ul> <li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
澳门葡京 16<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-7-3</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
$(“strong”).wrapAll(“<b></b>”); }); //]]>
</script> </head> <body> <strong
title=”选择你最欢乐的水果.” >你最欣赏的鲜果是?</strong>
<strong title=”选择你最喜爱的水果.”
>你最欢跃的水果是?</strong> <ul> <li
title=’苹果’>苹果</li> <li title=’橘子’>橘子</li>
<li title=’菠萝’>菠萝</li> </ul> </body>
</html> View Code
澳门葡京 17<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-7-4</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
$(“strong”).wrapInner(“<b></b>”); }); //]]>
</script> </head> <body> <strong
title=”选拔你最欣赏的水果.” >你最喜爱的鲜果是?</strong>
<ul> <li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  8.属性操作

澳门葡京 18曲线图例子,十行HTML完结增进现实。<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ /> <title>3-8</title>
<!– 引入jQuery –> <script src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
//设置<p>元素的特性’title’ $(“input:eq(0)”).click(function(){
$(“p”).attr(“title”,”选用你最欣赏的水果.”); });
//获取<p>元素的习性’title’ $(“input:eq(1)”).click(function(){
alert( $(“p”).attr(“title”) ); }); //删除<p>元素的质量’title’
$(“input:eq(2)”).click(function(){ $(“p”).removeAttr(“title”); }); });
//]]> </script> </head> <body> <input
type=”button” value=”设置<p>元素的特性’title'”/> <input
type=”button” value=”获取<p>元素的品质’title'”/> <input
type=”button” value=”删除<p>元素的习性’title'”/> <p
title=”选择你最欣赏的水果.” >你最喜爱的水果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  9.样式操作

澳门葡京 19<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-9-1</title> <style type=”text/css”> .high{
font-weight:bold; /* 粗体字 */ color : red; /* 字体颜色设置绿色*/ }
.another{ font-style:italic; color:blue; } </style> <!–
引入jQuery –> <script src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function () { //获取样式
$(“input:eq(0)”).click(function () { alert($(“p”).attr(“class”)); });
//设置样式 $(“input:eq(1)”).click(function () { $(“p”).attr(“class”,
“high”); }); //追加样式 $(“input:eq(2)”).click(function () {
$(“p”).addClass(“another”); }); //删除全部样式
$(“input:eq(3)”).click(function () { $(“p”).removeClass(); });
//删除指定样式 $(“input:eq(4)”).click(function () {
$(“p”).removeClass(“high”); }); //重复切换样式
$(“input:eq(5)”).click(function () { $(“p”).toggleClass(“another”); });
//判断元素是否包蕴某样式 $(“input:eq(6)”).click(function () {
alert($(“p”).hasClass(“another”)); alert($(“p”).is(“.another”)); //同上
}); }); //]]> </script> </head> <body> <input
type=”button” value=”输出class类”/> <input type=”button”
value=”设置class类”/> <input type=”button”
value=”追加class类”/> <input type=”button”
value=”删除所有class类”/> <input type=”button”
value=”删除指定class类”/> <input type=”button”
value=”重复切换class类”/> <input type=”button”
value=”判断元素是或不是带有某个class类”/> <p class=”myClass”
title=”选取你最喜爱的水果.” >你最欢悦的水果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  10.安装获取HTML,文本和值

澳门葡京 20<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-10-1</title> <style type=”text/css”> .test{
font-weight:bold; color : red; } .add{ font-style:italic; }
</style> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
//获取<p>元素的HTML代码 $(“input:eq(0)”).click(function(){ alert(
$(“p”).html() ); }); //获取<p>元素的文本
$(“input:eq(1)”).click(function(){ alert( $(“p”).text() ); });
//设置<p>元素的HTML代码 $(“input:eq(2)”).click(function(){
$(“p”).html(“<strong>你最欣赏的视频是?</strong>”); });
//设置<p>元素的文书 $(“input:eq(3)”).click(function(){
$(“p”).text(“你最喜爱的名家是?”); }); //设置<p>元素的文件
$(“input:eq(4)”).click(function(){
$(“p”).text(“<strong>你最欢愉的娱乐是?</strong>”); });
//获取按钮的value值 $(“input:eq(5)”).click(function(){ alert(
$(this).val() ); }); //设置按钮的value值
$(“input:eq(6)”).click(function(){ $(this).val(“我被点击了!”); }); });
//]]> </script> </head> <body> <input
type=”button” value=”获取<p>元素的HTML代码”/> <input
type=”button” value=”获取<p>元素的文书”/> <input
type=”button” value=”设置<p>元素的HTML代码”/> <input
type=”button” value=”设置<p>元素的文书”/> <input
type=”button” value=”设置<p>元素的公文(带HTML)”/> <input
type=”button” value=”获取按钮的value值”/> <input type=”button”
value=”设置按钮的value值”/> <p title=”选用你最喜爱的水果.”
><strong>你最高兴的水果是?</strong></p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
澳门葡京 21<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-10-2-1</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
$(“#address”).focus(function(){ // 地址框得到鼠标主题 var txt_value =
$(this).val(); // 获得当前文本框的值 if(txt_value==”请输入邮箱地址”){
$(this).val(“”); // 如若符合条件,则清空文本框内容 } });
$(“#address”).blur(function(){ // 地址框失去鼠标宗旨 var txt_value =
$(this).val(); // 拿到当前文本框的值 if(txt_value==””){
$(this).val(“请输入邮箱地址”);// 借使符合条件,则设置情节 } })
$(“#password”).focus(function(){ var txt_value = $(this).val();
if(txt_value==”请输入邮箱密码”){ $(this).val(“”); } });
$(“#password”).blur(function(){ var txt_value = $(this).val();
if(txt_value==””){ $(this).val(“请输入邮箱密码”); } }) }); //]]>
</script> </head> <body> <input type=”text”
id=”address” value=”请输入邮箱地址”/> <br/><br/>
<input type=”text” id=”password” value=”请输入邮箱密码”/>
<br/><br/> <input type=”button” value=”登陆”/>
</body> </html> View
Code
澳门葡京 22<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-10-2-2</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function () {
$(“#address”).focus(function () { // 地址框得到鼠标主旨 var txt_value
= $(this).val(); // 得到当前文本框的值 if (txt_value ==
this.defaultValue) { $(this).val(“”); // 假使符合条件,则清空文本框内容
} }); $(“#address”).blur(function () { // 地址框失去鼠标主旨 var
txt_value = $(this).val(); // 获得当前文本框的值 if (txt_value == “”)
{ $(this).val(this.defaultValue); // 假如符合条件,则设置情节 } })
$(“#password”).focus(function () { var txt_value = $(this).val(); if
(txt_value == this.defaultValue) { $(this).val(“”); } });
$(“#password”).blur(function () { var txt_value = $(this).val(); if
(txt_value == “”) { $(this).val(this.defaultValue); } }) }); //]]>
</script> </head> <body> <input type=”text”
id=”address” value=”请输入邮箱地址”/> <br/><br/>
<input type=”text” id=”password” value=”请输入邮箱密码”/>
<br/><br/> <input type=”button” value=”登陆”/>
</body> </html> View
Code
澳门葡京 23<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-10-3</title> <style type=”text/css”> .test{
font-weight:bold; color : red; } .add{ font-style:italic; }
</style> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
//设置单选下拉框选中 $(“input:eq(0)”).click(function(){
$(“#single”).val(“选用2号”); }); //设置多选下拉框选中
$(“input:eq(1)”).click(function(){ $(“#multiple”).val([“选择2号”,
“选择3号”]); }); //设置单选框和多选框选中
$(“input:eq(2)”).click(function(){
$(“:checkbox”).val([“check2″,”check3”]);
$(“:radio”).val([“radio2″]); }); }); //]]> </script>
</head> <body> <input type=”button”
value=”设置单选下拉框选中”/> <input type=”button”
value=”设置多选下拉框选中”/> <input type=”button”
value=”设置单选框和多选框选中”/> <br/><br/> <select
id=”single”> <option>选用1号</option>
<option>选拔2号</option>
<option>选择3号</option> </select> <select
id=”multiple” multiple=”multiple” style=”height:120px;”> <option
selected=”selected”>接纳1号</option>
<option>拔取2号</option>
<option>采取3号</option>
<option>选拔4号</option> <option
selected=”selected”>选取5号</option> </select>
<br/><br/> <input type=”checkbox” value=”check1″/>
多选1 <input type=”checkbox” value=”check2″/> 多选2 <input
type=”checkbox” value=”check3″/> 多选3 <input type=”checkbox”
value=”check4″/> 多选4 <br/> <input type=”radio”
value=”radio1″/> 单选1 <input type=”radio” value=”radio2″/>
单选2 <input type=”radio” value=”radio3″/> 单选3 </body>
</html> View Code
澳门葡京 24<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-10-4</title> <style type=”text/css”> .test{
font-weight:bold; color : red; } .add{ font-style:italic; }
</style> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
//设置单选下拉框选中 $(“input:eq(0)”).click(function(){ $(“#single
option”).removeAttr(“selected”); //移除属性selected $(“#single
option:eq(1)”).attr(“selected”,true); //设置属性selected });
//设置多选下拉框选中 $(“input:eq(1)”).click(function(){ $(“#multiple
option”).removeAttr(“selected”); //移除属性selected $(“#multiple
option:eq(2)”).attr(“selected”,true);//设置属性selected $(“#multiple
option:eq(3)”).attr(“selected”,true);//设置属性selected });
//设置单选框和多选框选中 $(“input:eq(2)”).click(function(){
$(“:checkbox”).removeAttr(“checked”); //移除属性checked
$(“:radio”).removeAttr(“checked”); //移除属性checked
$(“[value=check2]:checkbox”).attr(“checked”,true);//设置属性checked
$(“[value=check3]:checkbox”).attr(“checked”,true);//设置属性checked
$(“[value=radio2]:radio”).attr(“checked”,true);//设置属性checked });
}); //]]> </script> </head> <body> <input
type=”button” value=”设置单选下拉框选中”/> <input type=”button”
value=”设置多选下拉框选中”/> <input type=”button”
value=”设置单选框和多选框选中”/> <br/><br/> <select
id=”single”> <option>接纳1号</option>
<option>采取2号</option>
<option>选取3号</option> </select> <select
id=”multiple” multiple=”multiple” style=”height:120px;”> <option
selected=”selected”>接纳1号</option>
<option>选用2号</option>
<option>接纳3号</option>
<option>选拔4号</option> <option
selected=”selected”>接纳5号</option> </select>
<br/><br/> <input type=”checkbox” value=”check1″/>
多选1 <input type=”checkbox” value=”check2″/> 多选2 <input
type=”checkbox” value=”check3″/> 多选3 <input type=”checkbox”
value=”check4″/> 多选4 <br/> <input type=”radio”
value=”radio1″ name=”a”/> 单选1 <input type=”radio” value=”radio2″
name=”a”/> 单选2 <input type=”radio” value=”radio3″ name=”a”/>
单选3 </body> </html> View Code

  11.遍历节点

澳门葡京 25<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-11-1</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $body =
$(“body”).children(); var $p = $(“p”).children(); var $ul =
$(“ul”).children(); alert( $body.length ); //
<body>元素下有2个子元素 alert( $p.length ); //
<p>元素下有0个子元素 alert( $ul.length ); //
<p>元素下有3个子元素 for(var i=0;i< $ul.length;i++){ alert(
$ul[i].innerHTML ); } }); //]]> </script> </head>
<body> <p title=”接纳你最欣赏的水果.”
>你最喜爱的鲜果是?</p> <ul> <li
title=’苹果’>苹果</li> <li title=’橘子’>橘子</li>
<li title=’菠萝’>菠萝</li> </ul> </body>
</html> View Code
澳门葡京 26<澳门葡京,!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-11-2</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){ var $p1 =
$(“p”).next(); alert( $p1.html() ); // 紧邻<p>元素后的同辈元素 var
$ul = $(“ul”).prev(); alert( $ul.html() ); //
紧邻<ul>元素前的同辈元素 var $p2 = $(“p”).siblings(); alert(
$p2.html() ); // 紧邻<p>元素的绝无仅有同辈元素 }); //]]>
</script> </head> <body> <p
title=”选择你最欢快的水果.” >你最欣赏的水果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code
澳门葡京 27<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-11-3</title> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function () {
$(document).bind(“click”, function (e) {
$(e.target).closest(“li”).css(“color”, “red”); }) }); //]]>
</script> </head> <body> <p
title=”选拔你最喜爱的水果.” >你最喜爱的鲜果是?</p> <ul>
<li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

  12.CSS-DOM操作

澳门葡京 28<!DOCTYPE
html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html> <head> <meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
<title>3-12-1</title> <style type=”text/css”> .test{
font-weight:bold; color : red; } .add{ font-style:italic; }
</style> <!– 引入jQuery –> <script
src=”../../scripts/jquery-1.3.1.js”
type=”text/javascript”></script> <script
type=”text/javascript”> //<![CDATA[ $(function(){
//获取<p>元素的color $(“input:eq(0)”).click(function(){ alert(
$(“p”).css(“color”) ); }); //设置<p>元素的color
$(“input:eq(1)”).click(function(){ $(“p”).css(“color”,”red”) });
//设置<p>元素的fontSize和backgroundColor
$(“input:eq(2)”).click(function(){ $(“p”).css({“fontSize”:”30px”
,”backgroundColor”:”#888888″}) }); //获取<p>元素的惊人
$(“input:eq(3)”).click(function(){ alert( $(“p”).height() ); });
//获取<p>元素的增幅 $(“input:eq(4)”).click(function(){ alert(
$(“p”).width() ); }); //获取<p>元素的莫大
$(“input:eq(5)”).click(function(){ $(“p”).height(“100px”); });
//获取<p>元素的宽窄 $(“input:eq(6)”).click(function(){
$(“p”).width(“400px”); }); //获取<p>元素的的右侧距和上边距
$(“input:eq(7)”).click(function(){ var offset = $(“p”).offset(); var
left = offset.left; var top = offset.top;
alert(“left:”+left+”;top:”+top); }); }); //]]> </script>
</head> <body> <input type=”button”
value=”获取<p>元素的color”/> <input type=”button”
value=”设置<p>元素的color”/> <input type=”button”
value=”设置<p>元素的fontSize和backgroundColor”/> <input
type=”button” value=”获取<p>元素的惊人”/> <input
type=”button” value=”获取<p>元素的小幅”/> <input
type=”button” value=”设置<p>元素的万丈”/> <input
type=”button” value=”设置<p>元素的肥瘦”/> <input
type=”button” value=”获取<p>元素的的右边距和上面距”/> <p
title=”接纳你最欢畅的水果.”><strong>你最欣赏的瓜果是?</strong></p>
<ul> <li title=’苹果’>苹果</li> <li
title=’橘子’>橘子</li> <li title=’菠萝’>菠萝</li>
</ul> </body> </html> View Code

 PS:参考文献《锋利的jQuery》

Highcharts翻译序列之十九:曲线图例子(1)
 

引入库

XHTML

<script
src=”;
<script
src=”;
<script>THREEx.ArToolkitContext.baseURL =
‘;

1
2
3
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
<script src="https://rawgit.com/jeromeetienne/ar.js/master/aframe/build/aframe-ar.js"></script>
<script>THREEx.ArToolkitContext.baseURL = ‘https://rawgit.com/jeromeetienne/ar.js/master/three.js/'</script>

率先,你必要引入a-frame,一款MozillaVR引领的花费VR 体验的利器。A-frame 包罗了 three.js。然后你只要求为 a-frame 引入
AR.js。AR.js能让 AR 中的 3d 呈现在您的手机上高速运行,哪怕是 2、3
年前的旧手机。

俺们多年来公布了AR.js。你不须要设置任何利用,用你的手机通过网络就能感受到有力的增高现实。但让大家更进一步,看一下哪些让您也撰文出团结的滋长现实感受。多亏了神奇的a-frame,最短的
AR.js只有10行HTML 代码。

对此jquery一些标题

哇哦,我帮您写代码:
<script type=”text/javascript”>
$(function(){
$(“.has_children”).click(function(){
$(this).addClass(“highlight”)
.children(“a”).show().end()
.siblings().removeClass(“highlight”)
.children(“a”).hide();
});

});

代码:

定义 Body

XHTML

<body style=’margin : 0px; overflow: hidden;’> <!– … –>
</body>

1
2
3
<body style=’margin : 0px; overflow: hidden;’>
    <!– … –>
</body>

这一步,国际惯例。就如你在有着 HTML 页面中做的同等,定义 body。

澳门葡京 29

</script>

看出来去其余呢?一定要加在:
$(function(){ })
的函数内。

您之所以没意义,是因为你绑定事件的时候 ,dom 节点根本不设有。
而 $(function(){ }) 这些函数的情致是,当 所有 html

[html]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> 
<html> 
<head> 
    <title>重量曲线图</title> 
    <script type=”text/javascript”
src=”Lib/Scripts/jquery-1.7.2.min.js”></script> 
    <script type=”text/javascript”> 
        $(function () { 
            var splinechart; 
            $(document).ready(function () { 
                splinechart = new Highcharts.Chart({ 
                    chart: { 
                        renderTo: ‘splineContainer’, 
                        type: ‘spline’, 
                        margin: [25, 30, 70, 50] 
                    }, 
                    title: { 
                        text: ‘体重’, 
                        x: 50, 
                        y: 10, 
                        style: { 
                            display: ‘none’ 
                        } 
                    }, 
                    color: [ 
                    ‘#006ebe’ 
                    ], 
                    subtitle: { 
                        style: { 
                            display: ‘none’ 
                        } 
                    }, 
                    xAxis: { 
                        lineWidth: 1, 
                        lineColor: ‘#dfe7ef’, 
                        gridLineWidth: 0, 
                        lineColor: ‘#000000’, 
                        startOnTick: true, 
                        tickPixelInterval: 110, 
                        type: ‘datetime’, 
                        labels: { 
                            rotation: -45, 
                            y: 40, 
                            style: { 
                                color: ‘#000000’, 
                                fontSize: ‘8px’, 
                                fontWeight: ‘normal’ 
 
                            } 
                        }, 
                        tickColor: ‘#000000’, 
                        tickLength: 5, 
                        tickWidth: 1, 
                        dateTimeLabelFormats: { 
                            day: ‘%Y-%m-%d’, 
                            week: ‘%Y-%m-%d’, 
                            month: ‘%Y-%m-%d’, 
                            year: ‘%Y-%m-%d’ 
                        }, 
                        title: { 
                            style: 
                      { 
                          display: ‘none’ 
                      } 
                        } 
 
                    }, 
              yAxis: { 
                        allowDecimals: true, 
                        startOnTick: true, 
                        endOnTick: true, 
                        lineWidth: 1, 
                        gridLineWidth:0, 
                        gridLineColor: ‘#d3d3d3’, 
                        lineColor: ‘#000000’, 
                        tickColor: ‘#000000’, 
                        tickLength: 5, 
                        tickWidth: 1, 
                        title: { 
                            text: ‘重量(kg)’, 
                            style: { 
                                color: ‘#02528b’, 
                                fontSize: ’12px’, 
                                fontWeight: ‘normal’ 
 
                            } 
                        }, 
                        labels: { 
                            style: { 
                                color: ‘#000000’, 
                                fontSize: ’10px’, 
                                fontWeight: ‘normal’ 
                            } 
                        } 
                    }, 
                    legend: { 
                        layout: ‘horizontal’, 
                        backgroundColor: ‘#ffffff’, 
                        align: ‘right’, 
                        verticalAlign: ‘top’, 
                        x: 0, 
                        y: -10, 
                        floating: true, 
                        shadow: false, 
                        borderWidth: 0 
                    }, 
                    tooltip: { 
                        shared: true, 
                        crosshairs: true 
                    }, 
                    plotOptions: { 
                        spline: { 
                            shadow: false, 
                            animation: false, 
                            lineWidth: 1 
                        }, 
                        series: { 
                            color: ‘#000000’, 
                            marker: { 
                                enabled: true, 
                                fillColor: ‘#006ebe’, 
                                lineWidth: 1, 
                                lineColor: ‘#006ebe’, 
                                radius: 3 
                            } 
                        } 
                    }, 
                    series: [{ 
                        name: ‘重量’, 
                        data: [[Date.UTC(2012, 9, 8, 10, 22, 00),
88.8], [Date.UTC(2012, 9, 10, 10, 22, 00), 87.9], [Date.UTC(2012, 9,
13, 10, 00, 00), 87.4], [Date.UTC(2012, 9, 14, 12, 05), 87.2],
[Date.UTC(2012, 9, 16, 10, 00, 00), 87.2], [Date.UTC(2012, 9, 18, 10,
00, 00), 86.8], [Date.UTC(2012, 9, 22, 10, 00, 00), 86.5],
[Date.UTC(2012, 9, 25, 10, 00, 00), 86.5], [Date.UTC(2012, 9, 30, 10,
00, 00), 86.4]], 
                        dataLabels: { 
                            enabled: true 
                        } 
 
                    }] 
 
                }); 
            }); 
 
        }); 
    </script> 
</head> 
<body> 
    <script src=”Lib/Highcharts-2.2.5/js/highcharts.js”
type=”text/javascript”></script> 
    <!– <script
src=”../../js/modules/exporting.js”></script>–> 
    <div id=”bg” style=”margin: 0; padding: 0;”> 
        <div style=”width: 736px; margin: 0 auto; height: 27px;
line-height: 27px; font-family: Microsoft YaHei; 
            font-size: 14px”> 
            <span style=”color:
#006ebd;”>体重曲线图:</span><span style=”font-size: 14px;
color: #000000;”>单位[kg]</span></div> 
        <div id=”splineContainer” style=”width: 736px; height: 310px;
margin: 0 auto; padding-bottom: 10px; 
            border-bottom: 1px dashed #9b9b9b;”> 
        </div> 
    </div> 
</body> 
</html> 

创建 3d 场景

XHTML

<a-scene embedded artoolkit=’sourceType: webcam;’> <!– put
your 3d content here –> </a-scene>

1
2
3
<a-scene embedded artoolkit=’sourceType: webcam;’>
    <!– put your 3d content here –>
</a-scene>

下一场,大家即将创制我们的 a-farme 场景。大家自然也亟需加入 ARToolkit
组件。ARToolkit是一个开源库,大家由此它来完成视频头定位。

引入库

文本加载渲染完结的时候,才发轫履行。

^_* ,这样可以设为最佳了呢?谢谢哦
 

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<html>
<head>
    <title>重量曲线图</title>
    <script type=”text/javascript”
src=”Lib/Scripts/jquery-1.7.2.min.js”></script>
    <script type=”text/javascript”>
        $(function () {
            var splinechart;
            $(document).ready(function () {
                splinechart = new Highcharts.Chart({
                    chart: {
                        renderTo: ‘splineContainer’,
                        type: ‘spline’,
                        margin: [25, 30, 70, 50]
                    },
                    title: {
                        text: ‘体重’,
                        x: 50,
                        y: 10,
                        style: {
                            display: ‘none’
                        }
                    },
                    color: [
                    ‘#006ebe’
                    ],
                    subtitle: {
                        style: {
                            display: ‘none’
                        }
                    },
                    xAxis: {
                        lineWidth: 1,
                        lineColor: ‘#dfe7ef’,
                        gridLineWidth: 0,
                        lineColor: ‘#000000’,
                        startOnTick: true,
                        tickPixelInterval: 110,
                        type: ‘datetime’,
                        labels: {
                            rotation: -45,
                            y: 40,
                            style: {
                                color: ‘#000000’,
                                fontSize: ‘8px’,
                                fontWeight: ‘normal’

增加简单的始末

XHTML

<a-box position=’0 0.5 0′ material=’opacity: 0.5;’></a-box>

1
<a-box position=’0 0.5 0′ material=’opacity: 0.5;’></a-box>

假诺大家创立了 3d
场景,大家可以起来向其中添加对象。在那行代码中,大家添加了一个简短的盒子。然后大家修改了它的材质,让它变得透明。大家也转移了它的岗位,所以它出现在
AR 标识(AR marker)的下面。

(摄像截图)

澳门葡京 30

澳门葡京 31

jQuery:那里是怎完结?原代码没看懂

您那段代码中jquery只是拍卖了,<span>的click事件。
当click发生时,只突显大标题,并且点击了哪个大标题,就会显示其下相应的小标题。

有关为什么一进入页面就显得大标题,可能跟你的css有关系吗。
 

jQuery中的DOM操作,jquerydom DOM(Document
Object
Model)文档对象模型,每张网页都能用DOM表示出来,每一份DOM都能看做一颗DOM树。
jQuery继承…

                            }
                        },
                        tickColor: ‘#000000’,
                        tickLength: 5,
                        tickWidth: 1,
                        dateTimeLabelFormats: {
                            day: ‘%Y-%m-%d’,
                            week: ‘%Y-%m-%d’,
                            month: ‘%Y-%m-%d’,
                            year: ‘%Y-%m-%d’
                        },
                        title: {
                            style:
                      {
                          display: ‘none’
                      }
                        }

增加 AR 摄像头

XHTML

<a-marker-camera preset=’hiro’></a-marker-camera>

1
<a-marker-camera preset=’hiro’></a-marker-camera>

在结尾一步,我们伸张一个视频头。大家预设一个 ‘hiro’(来自Hiro
marker)最后,我们让它像您手机同样移动。是否很简短?

恭喜!你完了了。你仅用了 10 行 HTML
代码完毕了增强现实,手机上也能运作高效,而且免费。

可以看一下自身做的视频教程(搬运自youtube,字幕为 youtube
自动识别内嵌字幕,有微量识别误差,不影响观望):

(一些截图)

澳门葡京 32

打赏协助自己翻译更加多好文章,谢谢!

打赏译者

率先,你需求引入a-frame,一款MozillaVR引领的支付 VR 体验的利器。A-frame
包括了 three.js。然后你只需求为 a-frame 引入 AR.js。AR.js能让 AR 中的 3d
展现在您的无绳电话机上高速运行,哪怕是 2、3 年前的旧手机。

                    },
              yAxis: {
                        allowDecimals: true,
                        startOnTick: true,
                        endOnTick: true,
                        lineWidth: 1,
                        gridLineWidth:0,
                        gridLineColor: ‘#d3d3d3’,
                        lineColor: ‘#000000’,
                        tickColor: ‘#000000’,
                        tickLength: 5,
                        tickWidth: 1,
                        title: {
                            text: ‘重量(kg)’,
                            style: {
                                color: ‘#02528b’,
                                fontSize: ’12px’,
                                fontWeight: ‘normal’

打赏协助我翻译愈多好小说,谢谢!

任选一种支付办法

澳门葡京 33
澳门葡京 34

2 赞 8 收藏 1
评论

定义 Body

                            }
                        },
                        labels: {
                            style: {
                                color: ‘#000000’,
                                fontSize: ’10px’,
                                fontWeight: ‘normal’
                            }
                        }
                    },
                    legend: {
                        layout: ‘horizontal’,
                        backgroundColor: ‘#ffffff’,
                        align: ‘right’,
                        verticalAlign: ‘top’,
                        x: 0,
                        y: -10,
                        floating: true,
                        shadow: false,
                        borderWidth: 0
                    },
                    tooltip: {
                        shared: true,
                        crosshairs: true
                    },
                    plotOptions: {
                        spline: {
                            shadow: false,
                            animation: false,
                            lineWidth: 1
                        },
                        series: {
                            color: ‘#000000’,
                            marker: {
                                enabled: true,
                                fillColor: ‘#006ebe’,
                                lineWidth: 1,
                                lineColor: ‘#006ebe’,
                                radius: 3
                            }
                        }
                    },
                    series: [{
                        name: ‘重量’,
                        data: [[Date.UTC(2012, 9, 8, 10, 22, 00),
88.8], [Date.UTC(2012, 9, 10, 10, 22, 00), 87.9], [Date.UTC(2012, 9,
13, 10, 00, 00), 87.4], [Date.UTC(2012, 9, 14, 12, 05), 87.2],
[Date.UTC(2012, 9, 16, 10, 00, 00), 87.2], [Date.UTC(2012, 9, 18, 10,
00, 00), 86.8], [Date.UTC(2012, 9, 22, 10, 00, 00), 86.5],
[Date.UTC(2012, 9, 25, 10, 00, 00), 86.5], [Date.UTC(2012, 9, 30, 10,
00, 00), 86.4]],
                        dataLabels: {
                            enabled: true
                        }

至于小编:一杯哈希不加盐

澳门葡京 35

结业于曼海姆学院软件工程正式,身为
Java 程序猿也常用 JavaScript 做点好玩的东西
。为了兴趣而写代码,做要好喜好做的事。Keep Coding … Stay Cool …
(单身,欢迎打扰)
个人主页 ·
我的文章 ·
30 ·
   

澳门葡京 36

澳门葡京 37

                    }]

这一步,国际惯例。就好像您在享有 HTML 页面中做的如出一辙,定义 body。

                });
            });

创建 3d 场景。

        });
    </script>
</head>
<body>
    <script src=”Lib/Highcharts-2.2.5/js/highcharts.js”
type=”text/javascript”></script>
    <!– <script
src=”../../js/modules/exporting.js”></script>–>
    <div id=”bg” style=”margin: 0; padding: 0;”>
        <div style=”width: 736px; margin: 0 auto; height: 27px;
line-height: 27px; font-family: Microsoft YaHei;
            font-size: 14px”>
            <span style=”color:
#006ebd;”>体重曲线图:</span><span style=”font-size: 14px;
color: #000000;”>单位[kg]</span></div>
        <div id=”splineContainer” style=”width: 736px; height: 310px;
margin: 0 auto; padding-bottom: 10px;
            border-bottom: 1px dashed #9b9b9b;”>
        </div>
    </div>
</body>
</html>

澳门葡京 38

 

接下来,大家就要制造大家的 a-farme 场景。大家本来也急需进入 ARToolkit
组件。ARToolkit是一个开源库,大家透过它来落实视频头定位。

运转效果:

丰硕简单的情节

 

澳门葡京 39

 澳门葡京 40

倘诺大家成立了 3d
场景,大家得以先河向里面添加对象。在那行代码中,我们添加了一个简易的盒子。然后我们修改了它的材料,让它变得透明。我们也改成了它的任务,所以它出现在
AR 标识(AR marker)的上方。

 

增加 AR 摄像头

代码:
[html] !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN html
head title重量曲线图/title script typ…

澳门葡京 41

在最后一步,大家扩大一个视频头。大家预设一个
‘hiro’最终,大家让它像你手机一样移动。是或不是很粗略?

恭贺!你做到了。你仅用了 10
html代码完成了增强现实,手机上也能运作高效,而且免费。

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

*
*
Website