之前已经为大家介绍了好多导航菜单。今天为大家再带来一款由css3和jquery实现的卡片折叠式菜单。当菜单关闭的时候,有三维堆叠的效果。我们一起看下效果图:

在线预览   源码下载

html代码:

 <div id="wrapper">
<h1>
<i class="icon-sort-by-attributes"></i>CSS3 <span>Card Deck Drop Down</span></h1>
<div class="card-drop">
<a class="toggle active" href="#"><i class="icon-camera-retro"></i><span class="label-active">
sridhar</span> </a>
<ul>
<li class="" style="z-index: 6; top: 60px; width: 70%; margin-left: 40px;"><a data-label="Everyting"
href="#"><i class="icon-suitcase"></i>Everyting</a> </li>
<li class="" style="z-index: 5; top: 120px; width: 70%; margin-left: 40px;"><a data-label="Design"
href="#"><i class="icon-magic"></i>Design</a> </li>
<li class="" style="z-index: 4; top: 180px; width: 70%; margin-left: 40px;"><a data-label="UI-UX"
href="#"><i class="icon-bolt"></i>UI-UX</a> </li>
<li class="" style="z-index: 3; top: 240px; width: 70%; margin-left: 40px;"><a data-label="Print"
href="#"><i class="icon-tint"></i>Print</a> </li>
<li class="" style="z-index: 2; top: 300px; width: 70%; margin-left: 40px;"><a data-label="Photography"
href="#"><i class="icon-camera-retro"></i>Phtography</a> </li>
<li class="active" style="z-index: 1; top: 360px; width: 70%; margin-left: 40px;"><a
data-label="sridhar" href="#"><i class="icon-camera-retro"></i>sridhar</a> </li>
</ul>
</div>
<br /> <br /> <br />
<script src="/scripts/2bc/_gg_970_90.js" type="text/javascript"></script>
</div>

css3代码:

   html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video
{
margin:;
padding:;
border:;
font: inherit;
font-size: 100%;
vertical-align: baseline;
} ol, ul
{
list-style: none;
}
body
{
background-color: #F2EFE9;
overflow: visible;
padding-top: 40px;
font-family: helvetica, arial, sans-serif;
font-size: 1em;
} *
{
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
} #wrapper
{
width: 680px;
margin: 0 auto;
height: 1000px;
} h1
{
font-size: 2.5em;
text-align: center;
font-weight: bold;
margin-bottom: 10px;
line-height: 1.4em;
color: #4e6a6a;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
font-family: helvetica, arial, sans-serif;
}
h1 span
{
font-weight: lighter;
} .card-drop
{
max-width: 300px;
position: relative;
margin: 0 auto;
-webkit-perspective: 800px;
-moz-perspective: 800px;
-ms-perspective: 800px;
-o-perspective: 800px;
perspective: 800px;
}
.card-drop a
{
display: block;
width: 100%;
background-color: salmon;
padding: 20px 0 20px 20px;
height: 60px;
text-decoration: none;
color: #1e2929;
background-color: #5f8181;
border-bottom: 1px solid #4e6a6a;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.card-drop a i
{
display: inline-block;
width: 20px;
}
.card-drop > a.toggle
{
position: relative;
z-index:;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-transform-origin: 50% 0%;
-moz-transform-origin: 50% 0%;
-ms-transform-origin: 50% 0%;
-o-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-transition: 0.1s linear;
-moz-transition: 0.1s linear;
-o-transition: 0.1s linear;
transition: 0.1s linear;
background-color: #729797;
}
.card-drop > a.toggle:active
{
-webkit-transform: rotateX(60deg);
-moz-transform: rotateX(60deg);
-ms-transform: rotateX(60deg);
-o-transform: rotateX(60deg);
transform: rotateX(60deg);
}
.card-drop > a.toggle.active:before
{
content: "\f0d8";
}
.card-drop > a.toggle:before
{
border-left: 1px solid #4E6A6A;
color: #344646;
content: "?";
display: block;
font-family: 'FontAwesome';
font-size: 1.3em;
height: 59px;
line-height: 60px;
position: absolute;
right:;
text-align: center;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
top:;
width: 60px;
}
.card-drop ul
{
position: absolute;
height: 100%;
top:;
display: block;
width: 100%;
}
.card-drop ul li
{
margin: 0 auto;
-webkit-transition: all, 0.3s ease-out;
-moz-transition: all, 0.3s ease-out;
-o-transition: all, 0.3s ease-out;
transition: all, 0.3s ease-out;
position: absolute;
top:;
z-index:;
width: 100%;
}
.card-drop ul li a:hover
{
background-color: #6a9090;
color: #dce5e5;
}
.card-drop ul li.active a
{
color: #95b1b1;
background-color: #547272;
cursor: default;
}
.card-drop ul li.closed a:hover
{
cursor: default;
background-color: #5f8181;
}

js代码:

  $(document).ready(function () {
(function ($) {
//Author: Brady Sammons
//URL: www.bradysammons.com
/* -------------------------------------------------------- */
/* //set Global variables
/* -------------------------------------------------------- */
var cards = $(".card-drop"),
toggler = cards.find(".toggle"),
links = cards.find("ul>li>a"),
li = links.parent('li'),
count = links.length,
width = links.outerWidth(); console.info(count); console.info(width);
console.info(toggler);
console.info(links);
console.info(li);
console.info(cards); //set z-Index of drop Items
links.parent("li").each(function (i) {
$(this).css("z-index", count - i); //invert the index values
}); //set top margins & widths of li elements
function setClosed() {
li.each(function (index) {
$(this).css("top", index * 2) .css("width", width - index * 20)
.css("margin-left", (index * 20) / 2)
.css("margin-left", (index * 20) / 2);
}); li.addClass('closed');
toggler.removeClass("active");
}
setClosed(); /* -------------------------------------------------------- */
/* Toggler Click handler
/* -------------------------------------------------------- */
toggler.on("mousedown", function () {
var $this = $(this); //cache $(this)
//if the menu is active:
console.info(this);
if ($this.is(".active")) {
setClosed();
} else {
//if the menu is un-active:
$this.addClass("active");
li.removeClass('closed');
//set top margins
li.each(function (index) {
$(this).css("top", 60 * (index + 1))
.css("width", "70%")
.css("margin-left", "40px");
});
}
}); /* -------------------------------------------------------- */
/* Links Click handler
/* -------------------------------------------------------- */
links.on("click", function (e) {
var $this = $(this),
label = $this.data("label");
icon = $this.children("i").attr("class"); li.removeClass('active');
if ($this.parent("li").is("active")) {
$this.parent('li').removeClass("active");
} else {
$this.parent("li").addClass("active");
}
toggler.children("span").text(label);
toggler.children("i").removeClass().addClass(icon);
setClosed();
e.preventDefault;
}); })(jQuery);
}); //@ sourceURL=pen.js

注:本文爱编程原创文章,转载请注明原文地址:http://www.w2bc.com/Article/6739

一款由css3和jquery实现的卡面折叠式菜单的更多相关文章

  1. 一款由css3和jquery实现的响应式设计导航

    2014年响应式设计成为设计主流.今天要给大家带来一款由css3和jquery实现的响应式设计导航.当显示器为pc时,导航为横条.当客户端为移动端时,呈现坚形导航.我们一起看下效果图: 在线预览    ...

  2. 一款基于css3和jquery实现的动画弹出层

    今天给大家分享一款基于css3和jquery实现的动画弹出层.这款弹出层初页面面一个显示弹出层按钮.单击该按钮时,弹出层以非常炫的动画形式出现.弹出层有关闭按钮,单击半闭按钮,弹出层关闭.效果图如下: ...

  3. css3和jquery实现的可折叠导航菜单(适合手机网页)

    之前为大家介绍了好几款css3导航,今天为大家在介绍的是一款适合放在手机网页的导航菜单.点击列表图标以下拉式的形式显示菜单,单击关闭,动画关闭.效果相当不错.效果图如下: 在线预览   源码下载 这个 ...

  4. 美轮美奂!9款设计独特的jQuery/CSS3全新应用插件(下拉菜单、动画、图表、导航等)

    今天要为大家分享9款设计非常独特的jQuery/CSS3全新应用插件,插件包含菜单.jQuery焦点图.jQuery表单.jQuery图片特效等.下面大家一起来看看吧. 1.jQuery水晶样式下拉导 ...

  5. 10款最新CSS3/jQuery菜单导航插件

    这是我们在2014年收集的10款最新的CSS3 / jQuery菜单导航插件,不论从外观样式,还是功能扩展性,这些jQuery菜单一定可以满足大家的设计需求.这次我们收集的jQuery菜单,有水平 菜 ...

  6. 8款最新CSS3表单 环形表单很酷

    当我们在网站上注册登录还是提交评论,都需要用到表单,今天我们来分享8款最新CSS3表单,有几个效果很酷很特别,有些也非常实用,一起来看看. 1.CSS3环形特色表单 转圈切换表单焦点 这款CSS3表单 ...

  7. 11款样式新颖的 jQuery/CSS3 网页菜单

    今天为大家准备了11款样式风格挺不错的jQuery/CSS3网页菜单,主要包括面包屑菜单.下拉菜单.Tab菜单等,喜欢的朋友赶紧收藏,一起来看看这些菜单. 1.jQuery / CSS3多功能下拉菜单 ...

  8. 9款风格华丽的jQuery/CSS3插件

    今天向大家分享9款效果相当不错的jQuery/CSS3插件,不多说,直接来看看这些插件吧. 1.jQuery动画下拉菜单Smart Menu 这是一款基于jQuery的动画下拉菜单,子菜单外观比较时尚 ...

  9. 19款绚丽实用的jQuery/CSS3侧边栏菜单

    jQuery作为一款主流的JavaScript前端开发框架,深受广告开发者的亲睐,同时jQuery有着不计其数的插件,特别是菜单插件更为丰富,本文将要为大家介绍20个绚丽而实用的jQuery侧边栏菜单 ...

随机推荐

  1. openvpn服务端一键生成windows,macos客户端配置文件

    #!/bin/bash #获取参数 while getopts "n:" opt; do case $opt in n) client_name=$OPTARG ;; \?) ;; ...

  2. [转载]windows7中没用boot.ini文件而是改用BCDEDIT来配置了

    原文地址:windows7中没用boot.ini文件而是改用BCDEDIT来配置了作者:开心骝哥 本人安装的Win7,因为机上有两个系统,一个dos系统,一个win7系统,开机时总是会在系统选择的界面 ...

  3. 禁用root登录以及使用sudo分配权限

    前言 最近一段时间服务器有受到一些挖比特币的人的攻击,这里就简要说明一下提升服务器安全度的做法 禁用root登录 root权限可以说是linux服务器的最高权限,如果我们平常都是直接使用root用户来 ...

  4. 微软解决方案框架 - MSF的团队模型、MSF的开发模型,关于SA系统分析师信息的一篇好帖子

    msf中的开发模型 书中关于六个小组的人员的案例: MSF 组队模型 v. 3.1-http://bbs.51cto.com/thread-1171-1.html 微软解决方案框架 - MSF的团队模 ...

  5. Linux 通过cron定期执行 php文件(转)

    Linux 通过cron定期执行 php文件 补充几点: 1. 要在php文件头加上解释器的路径,通常是 #!/usr/bin/php 2. 授予要执行的php文件执行权限   chmod a+x x ...

  6. 作业调度框架_Quartz

    什么是Quartz Quartz是一个完全由Java编写的开源作业调度框架,为在Java应用程序中进行作业调度提供了简单却强大的机制.Quartz允许开发人员根据时间间隔来调度作业.它实现了作业和触发 ...

  7. C# 中一些类关系的判定方法 C#中关于增强类功能的几种方式 Asp.Net Core 轻松学-多线程之取消令牌

    1.  IsAssignableFrom实例方法 判断一个类或者接口是否继承自另一个指定的类或者接口. public interface IAnimal { } public interface ID ...

  8. c#基础之异常处理及自定义异常 从SQLServer转储数据到MySQL

    c#基础之异常处理及自定义异常 一.什么是c#中的异常? 异常是程序运行中发生的错误,异常处理是程序的一部分.c#中的异常类主要是直接或者间接的派生于 System.Exception类 ,也就是说S ...

  9. python-循环与判断练习题

    一.设计这样一个函数,在指定的文件夹上创建10个文本,以数字给它们命名. def text_creation(): path ='D:/study/python3/w/' for name in ra ...

  10. VC6.0编译DLL,使用VS2010调用问题及解决方法

    1.做驱动的时候.做应用程序须要和驱动通信,必须建立一个DLL. 2.由于客户使用版本号太低,须要使用到VC6.0编写DLL 3.在VC6.0上编写DLL的时候,导出的函数名会出现和原函数名不正确,导 ...