IT科技资讯
联系方式
您现在的位置:主页 > IT科技资讯 > 内容

一款由css3和jquery实现的卡面折叠式菜单,css3jquery

发布时间:2018-12-26 编辑:AG88

一款由css3和jquery实现的卡面折叠式菜单,css3jquery

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

 

在线预览   源码下载

 

html代码:

 <div id="wrapper">
        <h1>
            <i ></i>CSS3 <span>Card Deck Drop Down</span></h1>
        <div >
            <a  href="#"><i ></i><span >
                sridhar</span> </a>
            <ul>
                <li  ><a data-label="Everyting"
                    href="#"><i ></i>Everyting</a> </li>
                <li  ><a data-label="Design"
                    href="#"><i ></i>Design</a> </li>
                <li  ><a data-label="UI-UX"
                    href="#"><i ></i>UI-UX</a> </li>
                <li  ><a data-label="Print"
                    href="#"><i ></i>Print</a> </li>
                <li  ><a data-label="Photography"
                    href="#"><i ></i>Phtography</a> </li>
                <li  ><a
                    data-label="sridhar" href="#"><i ></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: 0;
            padding: 0;
            border: 0;
            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: 300;
            -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: 0;
            text-align: center;
            text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
            top: 0;
            width: 60px;
        }
        .card-drop ul
        {
            position: absolute;
            height: 100%;
            top: 0;
            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: 0;
            z-index: 0;
            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


jQuery,HTML5,CSS3的发展前途

哎 咋说呢 既然你是实习 说明你还有大把的时间 html css3 这个是基础 jsp jq这个是框架
结合起来 只要你都精通的话 就很完美了
随着时间的积累 你由制作 慢慢的向策划发展 也就是什么总监之类的职位 毕竟等你年龄大点了 比如说30几的话 在做前端 自己就感觉有点跟不上了 毕竟前端是个体力活啊
就目前来看 你别着急的去做啥后台之类的 就把你现有的做好 实习完后积累点大的项目 整站项目 然后再选择好点的公司 发展起来还是不错的
先积累 你现在的起点还是很好的 最起码比我这半路出家的好多了!
 
用html5+css3怎实现这个布局?

这个用css实现的
jqm有网格啊,不过都是平均分布的,比如你想要30%+70%的2个div是不行的,这个的自己写布局。
jqm都是50% 50% 或者 25% 25% 25% 25% 之类平均分布的,这是官方网格的demo
demos.jquerymobile.com/1.4.0/grids/
 

http://www.bkjia.com/jQuery/878790.htmlwww.bkjia.comtruehttp://www.bkjia.com/jQuery/878790.htmlTechArticle一款由css3和jquery实现的卡面折叠式菜单,css3jquery 之前已经为大家介绍了好多导航菜单。今天为大家再带来一款由css3和jquery实现的卡片折叠...

本文源自: 揭秘环亚娱乐骗局

上一篇:jquery ajax返回数据异常解决方法

下一篇:没有了

Copyright © 2005-2016 http://www.chickagoan.com 揭秘环亚娱乐骗局_揭秘环亚娱乐黑钱_环亚娱乐安全_网易新闻版权所有 揭秘环亚娱乐骗局_揭秘环亚娱乐黑钱_环亚娱乐安全_网易新闻