Mac OS X桌面菜单jQuery特效代码

版权:原创 更新时间:1年以上
[该文章底部包含文件资源,可根据自己情况,决定是否下载资源使用,时间>金钱,如有需要,立即查看资源]

以下是 Mac OS X桌面菜单jQuery特效代码 的示例演示效果:

当前平台(PC电脑)
  • 平台:

部分效果截图:

Mac OS X桌面菜单jQuery特效代码

HTML代码(index.html):

<!doctype html>
<html>
  <head>
    <title>Mac OS X桌面菜单jQuery</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <link rel="stylesheet" href="core/dockmenu.css">
    <script src="core/jquery-1.10.2.min.js"></script>
	<script src="core/dockmenu.min.js"></script>
	<style>
		html, body{ margin:0; padding:0; background: url(grey_wash_wall.png)}
		.row label
		{ 
			color: #999;
			margin: 0 0 5px 0;
			padding: 0;
			line-height: 30px;
			font-size: 13px;
			font-weight: normal;	
		}
		.menu{ padding: 10px; background: #303030; position: absolute; top: 0; left: 0; color: #fff; width: 315px; }
		.menu input, .menu select
		{
			background: rgba(0, 0, 0, 0.6);
			border: 1px solid #FFF;
			color: #FFF;
			padding: 2px 5px;
			width: 100px;
			float: right;
			margin-left: 10px; 
		}
		.close
		{
			position: absolute;
			right: -25px;
			background: #303030;
			width: 50px;
			text-align: right;
			padding: 2px 10px 3px 0;
			cursor: pointer;
		}
	</style>
    <script type="text/javascript">
      $(document).ready(function() {
        $('#wrapper1').dockmenu({
          buttons: [{
            'title': 'Settings',
            'href': '#settings',
            'imgURL': 'icons/Settings.png',
            'onClick': function(){
                              alert('You clicked on the Settings icon');
                            }
          },{
            'title': 'App Store',
            'href': '#AppStore',
            'imgURL': 'icons/AppStore.png',
        
          },{
            'title': 'Camera',
            'href': '#camera',
            'imgURL': 'icons/Camera.png',
        
          },{
            'title': 'Games',
            'href': '#Games',
            'imgURL': 'icons/Games.png',
        
          },{
            'title': 'Mail',
            'href': '#Mail',
            'imgURL': 'icons/Mail.png',
        
          },{
            'title': 'Music',
            'href': '#Music',
            'imgURL': 'icons/Music.png',
			'onClick': function(){
                              alert('You clicked on the Music icon');
                            }
          },{
            'title': 'Safari',
            'href': '#Safari',
            'imgURL': 'icons/Safari.png',
        
          },{
            'title': 'Photos',
            'href': '#Photos',
            'imgURL': 'icons/Photos.png',
        
          }]
      
        });
		
		$('.close').on('click', function()
		{
			if( $('.menu').position().left === 0 )
			{
				$('.menu').animate({'left':'-335px'}, 1000);
				$(this).html('>');
			}
			else
			{
				$('.menu').animate({'left':'0'}, 1000);
				$(this).html('x');
			}
		});
      });
	  
	  function recreate()
	  {
		var width = $('#width').val(),
		position = $('#position option:selected').val(),
		menuposition = $('#menuposition option:selected').val(),
		top = $('#top').val(),
		bottom = $('#bottom').val(),
		left = $('#left').val(),
		right = $('#right').val(),
		margin = $('#margin').val().split(','),
		padding = $('#padding').val().split(','),
		showBoard = $('#showBoard').val();
		
		$('#wrapper1').empty();
		
		$('#wrapper1').dockmenu({
			width: width,
			position: position,
			menuPosition: menuposition,
			top: top,
			bottom: bottom,
			left: left,
			right: right,
			margin: margin,
			padding: padding,
			showBoard:  $('#showBoard').is(':checked'),
          buttons: [{
            'title': 'Settings',
            'href': '#settings',
            'imgURL': 'icons/Settings.png',
            'onClick': function(){
                              alert('You clicked on the Settings icon');
                            }
          },{
            'title': 'App Store',
            'href': '#AppStore',
            'imgURL': 'icons/AppStore.png',
        
          },{
            'title': 'Camera',
            'href': '#camera',
            'imgURL': 'icons/Camera.png',
        
          },{
            'title': 'Games',
            'href': '#Games',
            'imgURL': 'icons/Games.png',
        
          },{
            'title': 'Mail',
            'href': '#Mail',
            'imgURL': 'icons/Mail.png',
        
          },{
            'title': 'Music',
            'href': '#Music',
            'imgURL': 'icons/Music.png',
			'onClick': function(){
                              alert('You clicked on the Music icon');
                            }
          },{
            'title': 'Safari',
            'href': '#Safari',
            'imgURL': 'icons/Safari.png',
        
          },{
            'title': 'Photos',
            'href': '#Photos',
            'imgURL': 'icons/Photos.png',
        
          }]
      
        });
	  }
    </script>
  </head>
  
  <body>
  
	<div class="menu">
		<div class="close">x</div>
		<h3>Options</h3>
		<div class="row">
			<label for="position">Position:</label>
			<select id="position">
				<option value="fixed" selected="selected">fixed</option>
				<option value="relative">relative</option>
				<option value="absolute">absolute</option>
			</select>
		</div>
		<div class="row">
			<label for="menuposition">Menu Position:</label>
			<select id="menuposition">
				<option value="bottom" selected="selected">bottom</option>
				<option value="left">left</option>
				<option value="right">right</option>
			</select>
		</div>
		<div class="row"><label for="width">Width:</label><input type="text" id="width" value="100%"/></div>
		<div class="row"><label for="top">Top:</label><input type="text" id="top" value="null"/></div>
		<div class="row"><label for="right">Right:</label><input type="text" id="right" value="null"/></div>
		<div class="row"><label for="bottom">Bottom:</label><input type="text" id="bottom" value="0"/></div>
		<div class="row"><label for="left">Left:</label><input type="text" id="left" value="0"/></div>
		<div class="row"><label for="margin">Margin: [top, right, bottom, left]</label> <input type="text" id="margin" value="0,0,10px,0"/></div>
		<div class="row"><label for="padding">Padding: [top, right, bottom, left]</label> <input type="text" id="padding" value="0,3%,0,3%"/></div>
		<div class="row"> <label for="showBoard">Show Board:</label> <input type="checkbox" checked="checked" id="showBoard"/></div>
		<button onClick="recreate(); return false;">Show</button>
	</div>
	<div id="wrapper1"></div><!-- Dockmenu build wrapper1 -->
  </body>
</html>







JS代码(dockmenu.min.js):

(function(e){
	"use strict";
	e.fn.dockmenu=function(t){
	var n={
	width:"100%",background:"#fff",position:"fixed",responsive:true,menuPosition:"bottom",top:"auto",bottom:0,left:0,right:"auto",margin:[0,0,10,0],padding:[0,"3%",0,"3%"],showBoard:true,autoHide:false,buttons:[{
}
]}
,r=e.extend({
}
,n,t),i=e(window),s=r.margin,o=r.padding,u=[],a=[],f=function(t){
	if(t.type==="mouseenter"){
	e(this).next().addClass("nearby");
	e(this).prev().addClass("nearby");
	e(this).find("span").toggle()}
else{
	e("#dock-menu-list li").removeClass("nearby");
	e(this).find("span").hide()}
}
;
	return this.each(function(){
	var t=e(this);
	var n=r.menuPosition==="bottom"||r.menuPosition==="top"?"tb":"lr";
	switch(e.type(s)){
	case"number":u=[s,s,s,s];
	break;
	case"array":u=[s[0],s[1],s[2],s[3]];
	break}
switch(e.type(o)){
	case"number":a=[o,o,o,o];
	break;
	case"array":a=[o[0],o[1],o[2],o[3]];
	break}
e("<div>").attr("id","dock-menu-wrapper").addClass(n).css({
	position:r.position,top:r.top,bottom:r.bottom,right:r.right,left:r.left}
).appendTo(t);
	var l=t.find("#dock-menu-wrapper");
	e("<ul>").attr("id","dock-menu-list").appendTo(l);
	var c=l.find("#dock-menu-list");
	if(u.length>0){
	e(l).css({
	"margin-top":u[0],"margin-right":u[1],"margin-bottom":u[2],"margin-left":u[3]}
)}
if(a.length>0&&n==="tb"){
	e(l).css({
	"padding-top":a[0],"padding-right":a[1],"padding-bottom":a[2],"padding-left":a[3]}
)}
if(r.autoHide){
	var h=null;
	e(l).on("mouseleave",function(){
	h=setTimeout(function(){
	e(l).animate({
	opacity:0,visibility:"hidden"}
,1e3)}
,5e3)}
).on("mouseenter",function(){
	clearTimeout(h);
	e(this).animate({
	opacity:1}
,1e3)}
)}
e.each(r.buttons,function(t,n){
	var r=function(){
	e(this).effect("bounce",{
	times:3}
,1500);
	n.onClick();
	return false}
;
	e("<li>").append(e("<a>").attr("href",this.href).append(e("<span>").html(this.title)).append(e("<img/>").attr("src",this.imgURL))).bind("click",this.onClick?r:"").appendTo(c)}
);
	if(n==="tb"){
	e(l).width(r.width);
	e(c).width(r.width)}
else{
	var p=(e(i).height()-e(c).height())/2;
	if(p>0){
	e(c).css({
	position:"absolute",top:p}
)}
if(r.menuPosition==="left"){
	e(l).css({
	left:0,right:"auto"}
)}
else{
	e(l).css({
	right:0,left:"auto"}
)}
}
if(r.showBoard&&n==="tb"){
	e("<div>").addClass("menu-perspective").width(r.width).append(e("<div>").addClass("menu-board metal-gradient").css("min-width",e(c).find("li").length*e(c).find("li").width())).appendTo(l);
	e(c).css("margin-bottom","-40px")}
else{
	l.addClass("no-board")}
if((u.length||a.length)&&n==="tb"){
	var d=e(l).outerWidth(true);
	var v=100-Math.round((d-e(i).width())/e(i).width()*100,.5);
	e(l).width(d>e(i).width()?v+"%":r.width)}
e(c).find("li").bind("mouseenter mouseleave",f)}
)}
}
)(jQuery)

CSS代码(dockmenu.css):

/* === Clear and fix === */
#dock-menu-wrapper .clearfix:after{clear:both;content:".";display:block;font-size:0;height:0;line-height:0;visibility:hidden}
#dock-menu-wrapper .clearfix{zoom:1}
/* === General styles === */
#dock-menu-wrapper .hide{display:none;}
#dock-menu-wrapper .show{display:block;}
/* === Dockmenu wrapper === */
#dock-menu-wrapper li,#dock-menu-wrapper a,#dock-menu-wrapper a:focus,#dock-menu-wrapper a:visited,#dock-menu-wrapper a:link,#dock-menu-wrapper a:hover,#dock-menu-wrapper img{outline:none;}
#dock-menu-wrapper.tb{position:fixed;}
#dock-menu-wrapper.lr{top:0;width:100px;}
/* === Dockmenu perspective board === */
#dock-menu-wrapper .menu-perspective{-webkit-perspective:260;-moz-perspective:260;perspective:260px;}
#dock-menu-wrapper.lr .menu-perspective{display:none;}
/* === Dockmenu board === */
#dock-menu-wrapper.tb .menu-board{width:90%;height:50px;margin:0 5%;position:relative;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0px 7px 25px -7px rgba(0,0,0,.8);-mox-box-shadow:0px 7px 25px -7px rgba(0,0,0,.8);box-shadow:0px 7px 25px -7px rgba(0,0,0,.8);-webkit-transform:rotateX(27deg);-moz-transform:rotateX(27deg);transform:rotateX(27deg);}
/* === Dockmenu list styles (ul) === */
#dock-menu-wrapper.tb #dock-menu-list{width:100%;margin:0;padding:0px;position:relative;list-style:none;text-align:center;white-space:nowrap;display:inline-block;vertical-align:bottom;}
#dock-menu-wrapper.lr #dock-menu-list{width:100px;margin:0;padding:0px;position:relative;list-style:none;text-align:center;white-space:nowrap;display:inline-block;vertical-align:middle;}
#dock-menu-wrapper .no-board #dock-menu-list{margin:0;}
#dock-menu-wrapper.tb #dock-menu-list li{position:relative;z-index:10;display:inline-block;vertical-align:bottom;white-space:nowrap;overflow:visible;margin:0 3px;}
#dock-menu-wrapper.lr #dock-menu-list li{position:relative;z-index:10;vertical-align:middle;white-space:nowrap;overflow:visible;margin:0 3px;}
#dock-menu-wrapper.tb #dock-menu-list .ui-effects-wrapper{width:106px;height:96px;display:inline-block;float:left;}
#dock-menu-wrapper.tb #dock-menu-list li a{width:64px;height:116px;position:relative;display:inline-block;vertical-align:bottom;text-decoration:none;white-space:normal;letter-spacing:normal;color:#000;text-align:center;-webkit-transition:all .4s ease-in-out;-moz-transition:all .4s ease-in-out;transition:all .4s ease-in-out;}
#dock-menu-wrapper.lr #dock-menu-list li a{width:64px;height:74px;position:relative;display:inline-block;text-decoration:none;white-space:normal;letter-spacing:normal;color:#000;text-align:center;-webkit-transition:all .4s ease-in-out;-moz-transition:all .4s ease-in-out;transition:all .4s ease-in-out;}
#dock-menu-wrapper #dock-menu-list li a:hover,#dock-menu-wrapper #dock-menu-list .ui-effects-wrapper li a{width:96px;height:96px;margin-bottom:10px;}
#dock-menu-wrapper #dock-menu-list li a img{width:100%;height:auto;position:absolute;left:0px;bottom:10px;text-align:center;border:0px none;/* margin-bottom:15px;*/
-webkit-box-reflect:below 0 -webkit-linear-gradient(top,transparent 70%,rgba(255,255,255,.1) 85%,rgba(0,0,0,.4) 100%);}
#dock-menu-wrapper #dock-menu-list li a:hover span:after{display:block;height:9px;width:100%;background:rgba(0,0,0,0) url("../icons/span.png") 50% 0 no-repeat;position:absolute;right:0;content:"";text-align:center;margin:0;padding:0;}
#dock-menu-wrapper.tb #dock-menu-list .nearby a,#dock-menu-wrapper.lr #dock-menu-list .nearby a{width:82px;height:82px;}
#dock-menu-wrapper #dock-menu-list li span{position:relative;line-height:1.3em;display:none;text-align:center;font-weight:bold;font-size:80%;padding:4px 12px;background-color:#ccc;margin:0px auto;top:-50px;border-radius:10px;-moz-border-radius:10px;-webkit-border-radius:10px;white-space:nowrap;}
/* === Dockmenu board metal effect background === */
#dock-menu-wrapper .metal-gradient{background:-webkit-radial-gradient(center,circle farthest-corner,rgba(255,255,255,0) 50%,rgba(200,200,200,1)),-webkit-radial-gradient(center,circle,rgba(255,255,255,.35),rgba(255,255,255,0) 20%,rgba(255,255,255,0) 21%),-webkit-radial-gradient(center,circle,rgba(0,0,0,.2),rgba(0,0,0,0) 20%,rgba(0,0,0,0) 21%),-webkit-radial-gradient(center,circle farthest-corner,#f0f0f0,#c0c0c0);background:-moz-radial-gradient(center,circle farthest-corner,rgba(255,255,255,0) 50%,rgba(200,200,200,1)),-moz-radial-gradient(center,circle,rgba(255,255,255,.35),rgba(255,255,255,0) 20%,rgba(255,255,255,0) 21%),-moz-radial-gradient(center,circle,rgba(0,0,0,.2),rgba(0,0,0,0) 20%,rgba(0,0,0,0) 21%),-moz-radial-gradient(center,circle farthest-corner,#f0f0f0,#c0c0c0);background:-ms-radial-gradient(center,circle farthest-corner,rgba(255,255,255,0) 50%,rgba(200,200,200,1)),-ms-radial-gradient(center,circle,rgba(255,255,255,.35),rgba(255,255,255,0) 20%,rgba(255,255,255,0) 21%),-ms-radial-gradient(center,circle,rgba(0,0,0,.2),rgba(0,0,0,0) 20%,rgba(0,0,0,0) 21%),-ms-radial-gradient(center,circle farthest-corner,#f0f0f0,#c0c0c0);}
附件:下载该文件资源,减少时间成本(增值服务)
留言
该资源可下载
File Source
.rar
217.22 KB
Html Js 菜单导航特效4
最新结算
股权转让协议意向书模板
类型: .docx 金额: CNY 2.23¥ 状态: 待结算 详细>
股权转让协议意向书模板
类型: .docx 金额: CNY 0.28¥ 状态: 待结算 详细>
CSS3图片向上3D翻转渐隐消失特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
CSS3图片向上3D翻转渐隐消失特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
.net c# 将金额转人名币大写金额
类型: .rar 金额: CNY 2.39¥ 状态: 待结算 详细>
.net c# 将金额转人名币大写金额
类型: .rar 金额: CNY 0.3¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 2.23¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 0.28¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 2.23¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 0.28¥ 状态: 待结算 详细>
我们力求给您提供有用的文章,再此基础上,会附加营收资源,不做任何广告,让平台可以更好发展 若您发现您的权利被侵害,或使用了您的版权,请发邮件联系 sunlifel@foxmail.com ggbig觉得 : 不提供源码的文章不是好文章
合作伙伴
联系我们
  • QQ:21499807
  • 邮箱:sunlifel@foxmail.com
  • QQ扫一扫加QQ
    QQ扫一扫
Copyright 2023-2024 ggbig.com·皖ICP备2023004211号-1
打赏文章