html五彩导航代码(html制作导航)
html5 导航路线效果
html5?导航路线效果:
调用核心代码:
script type="text/javascript" ?
//默认地理位置设置为上海市浦东新区
var x=121.48789949,y=31.24916171;
? ?window.onload = function() { ?
? ? ? ?if(navigator.geolocation) { ?
navigator.geolocation.getCurrentPosition(showPosition);
? ? ? ? ? ?document.getElementById("status").innerHTML = "HTML5 Geolocation is supported in your browser."; ?
? ? ? ? ? ? ? ?// 百度地图API功能 ?
? ? ? ? ? ? ? ?var map = new BMap.Map("container"); ?
? ? ? ? ? ? ? ?var point = new BMap.Point(x,y); ?
? ? ? ? ? ? ? ?map.centerAndZoom(point,12); ?
?
? ? ? ? ? ? ? ?var geolocation = new BMap.Geolocation(); ?
? ? ? ? ? ? ? ?geolocation.getCurrentPosition(function(r){ ?
? ? ? ? ? ? ? ? ? ?if(this.getStatus() == BMAP_STATUS_SUCCESS){ ?
? ? ? ? ? ? ? ? ? ? ? ?var mk = new BMap.Marker(r.point); ?
? ? ? ? ? ? ? ? ? ? ? ?map.addOverlay(mk); ?
? ? ? ? ? ? ? ? ? ? ? ?map.panTo(r.point); ?
? ? ? ? ? ? ? ? ? ?} ?
? ? ? ? ? ? ? ? ? ?else { ?
? ? ? ? ? ? ? ? ? ? ? ?alert('failed'+this.getStatus()); ?
? ? ? ? ? ? ? ? ? ?} ? ? ? ? ?
? ? ? ? ? ? ? ?},{enableHighAccuracy: true}) ?
return;
? ? ? ?} ?
? ? ? alert("当前的浏览器不支持获取地理位置!");
? ?}; ?
function showPosition(position){
?x=position.coords.latitude;
?y=position.coords.longitude;
}
/script ?
运行效果如下:
html5实现地图上定位导航路线
html5实现地图上定位导航路线方法如下:
1.先通过百度拾取坐标系统获得点位的坐标。
2.在网页的head中插入百度API引用脚本。
script type="text/javascript" src="
key=v=1.1services=true"/script
3.在网页的/body之后/html之前插入地图显示代码。
4.设置显示地图的div的id为“dituContent”,即添加 id="dituContent"
由于jqm的div的高度都是根据内容自由放大的,所以为了地图能正常显示,还需要
增加一个高度值,一般情况600px就可以,完成。
HTML5怎么做导航栏
建议使用FF,Safari,举个例子:
!doctype html
html
head
titleHTML5+CSS3+JavaScript/title
meta http-equiv="Content-Type" content="text/html; charset=gb2312" /
meta http-equiv="Content-Type" content="text/html; charset=gbk" /
meta http-equiv="Content-Type" content="text/html; charset=utf-8" /
meta http-equiv="Content-Language" content="zh-cn" /
meta name="Generator" content="EditPlus"
meta name="Author" content=""
meta name="Keywords" content=""
style type="text/css"
body {
behavior: url(ie-css3.htc);
}
* {margin:0 auto;padding:0;}
body {font-size:13px;font-family:Arial;}
ul li {list-style:none;}
#menu {
width:982px;
height:35px;
margin-top:20px;display:block;
background: #e3e3e3;
background: -moz-linear-gradient(top, #ccc, #999);
background: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#999));
-moz-box-shadow: 1px 1px 3px #333;
-webkit-box-shadow: 1px 1px 3px #333;
box-shadow: 1px 1px 3px #333;
-webkit-border-top-left-radius:4px;;
-webkit-border-top-right-radius:4px;
-moz-border-radius-topleft:4px;
-moz-border-radius-topright:4px;
-webkit-border-bottom-left-radius:4px;
-webkit-border-bottom-right-radius:4px;
-moz-border-radius-bottomleft:4px;
-moz-border-radius-bottomright:4px;
-o-border-radius:4px;
-khtml-border-radius:4px;
text-shadow: 0 1px 0 white;
}
#menu ul {
margin-left:0;
}
#menu ul li {
display:inline;
}
#menu ul li a:link, a:visited {
text-align:center;float:left;width:6.8em;text-decoration:none;padding:7.5px 0.75em;font-size:16px;font-weight:bold;margin-top:0px;border-right:1px solid #ccc;color: #454545;
}
#menu ul li a:hover {
text-decoration:none;
background:-webkit-gradient(linear, left top, left bottom, from(#333), to(#ccc));
background: -moz-linear-gradient(top, #333, #ccc);
-webkit-background-size:0 35px;
color: #ddd;
text-shadow: 0 1px 0 black;
}
.text {
border:1px solid gray;width:150px;height:17px;position:relative;top:8px;left:13px;font-family:Arial;
-webkit-border-top-left-radius:90px;;
-webkit-border-top-right-radius:90px;
-moz-border-radius-topleft:90px;
-moz-border-radius-topright:90px;
-webkit-border-bottom-left-radius:90px;
-webkit-border-bottom-right-radius:90px;
-moz-border-radius-bottomleft:90px;
-moz-border-radius-bottomright:90px;
-o-border-radius:90px;
-khtml-border-radius:90px;
}
/style
script language="JavaScript" type="text/javascript"
(function()
{
if(!0)
return;
var e = "abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog, eventsource,figure,footer,hgroup,header,mark,menu,meter,nav,output,progress,section,time,video".split(','),i=0,length=e.length;
while(ilength)
{
document.createElement_x(e[i++])
}
})();
/script
/head
body
menu id="menu"form action="index.php" method="get"
ul
lia href="#" title="HomePage"HomePage/a/li
lia href="#" title="Introuduce"Introuduce/a/li
lia href="#" title="Products"Products/a/li
lia href="#" title="My album"My album/a/li
lia href="#" title="Shopping"Shopping/a/li
lia href="#" title="Contact our"Contact our/a/li
/ul
input type="search" class="text" value="search..." //form
/menu
body
jquery+html5笔触导航菜单代码怎么用
我们将创建一个简单的jquery菜单,只要我们悬停在导航栏的区域里,将展示给我们的画面是:明亮的菜单在稍显黑暗的背景图中脱颖而出jquery导航是一个网站必不可少的模块,当一个用户在一个网站上浏览的时候,为了某个目的而查看网站导航栏的时候,突出导航栏的效果是重中之重。因此必须要使用一个效果:jquery遮罩层。利用明暗效果来突出当前用户的操作。 代码如下: $(function() { var $oe_menu= $('#oe_menu'); var $oe_menu_items= $oe_menu.children ('li'); var $oe_overlay= $('#oe_overlay'); $oe_menu_items.bind('mouseenter',function(){ var $this = $(this); $this.addClass('slided selected'); $this.children('div').css('z- index','9999').stop(true,true).slideDown(200,function(){ $oe_menu_items.not ('.slided').children('div').hide(); $this.removeClass('slided'); }); }).bind('mouseleave',function(){ var $this = $(this); $this.removeClass('selected').children ('div').css('z-index','1'); }); $oe_menu.bind('mouseenter',function(){ var $this = $(this); $oe_overlay.stop(true,true).fadeTo(200, 0.6); $this.addClass('hovered'); }).bind('mouseleave',function(){ var $this = $(this); $this.removeClass('hovered'); $oe_overlay.stop(true,true).fadeTo(200, 0); $oe_menu_items.children('div').hide(); }) });

我用html做了一个导航栏,代码如下:
ul的父亲是div啊,你把div的内左边内边矩设为0,padding-left:0;试试。