基于jquery的手风琴图片展示效果实现方法

本文实例讲述了基于jquery的手风琴图片展示效果实现方法。分享给大家供大家参考。具体实现方法如下:

代码运行效果如下图所示:

index.html页面代码如下:

代码如下:

<!DOCTYPE html>
<html class=''>
<head>
    <title>一款基于jquery的手风琴图片展示效果demo</title>
    <style class="cp-pen-styles">
        div
        {
            -moz-box-sizing: border-box;
            box-sizing: border-box;
        }
       
        html, body, .page-container
        {
            height: 100%;
            overflow: hidden;
        }
       
        .page-container
        {
            -webkit-transition: padding 0.2s ease-in;
            transition: padding 0.2s ease-in;
            padding: 80px;
        }
        .page-container.opened
        {
            padding: 0;
        }
        .page-container.opened .flex-container .country:not(.active)
        {
            opacity: 0;
            -webkit-flex: 0;
            -ms-flex: 0;
            flex: 0;
        }
        .page-container.opened .flex-container .country:not(.active) div
        {
            opacity: 0;
        }
        .page-container.opened .flex-container .active:after
        {
            -webkit-filter: grayscale(0%) !important;
            filter: grayscale(0%) !important;
        }
       
        .flex-container
        {
            display: -webkit-flex;
            display: -ms-flexbox;
            display: flex;
            height: 100%;
        }
        @media all and (max-width: 900px)
        {
            .flex-container
            {
                -webkit-flex-direction: column;
                -ms-flex-direction: column;
                flex-direction: column;
            }
        }
       
        .country
        {
            position: relative;
            -webkit-flex-grow: 1;
            -ms-flex-positive: 1;
            flex-grow: 1;
            -webkit-flex: 1;
            -ms-flex: 1;
            flex: 1;
            -webkit-transition: 0.5s ease-in-out;
            transition: 0.5s ease-in-out;
            cursor: pointer;
            font-family: "Bree Serif" , serif;
            text-align: center;
            color: #fff;
            font-size: 22px;
            text-shadow: 0 0 3px #000;
        }
        .country div
        {
            position: absolute;
            width: 100%;
            z-index: 10;
            top: 50%;
            text-align: center;
            -webkit-transition: 0.1s;
            transition: 0.1s;
            -webkit-transform: translateY(-50%);
            -ms-transform: translateY(-50%);
            transform: translateY(-50%);
            -webkit-filter: none;
            filter: none;
        }
        .country:after
        {
            content: " ";
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-size: cover;
            -webkit-transition: 0.5s ease-in-out;
            transition: 0.5s ease-in-out;
            -webkit-filter: grayscale(100%);
            filter: grayscale(100%);
        }
        .country:hover
        {
            -webkit-flex-grow: 6;
            -ms-flex-positive: 6;
            flex-grow: 6;
        }
        .country:hover:after
        {
            -webkit-filter: grayscale(0%);
            filter: grayscale(0%);
        }
        @media all and (max-width: 900px)
        {
            .country
            {
                height: auto;
            }
        }
       
        .netherlands:after
        {
            background-image: url("Netherlands.png");
            background-position: center;
        }
       
        .belgium:after
        {
            background-image: url("belgium-307_3.jpg");
            background-position: center;
        }
       
        .france:after
        {
            background-image: url("30.jpg");
            background-position: center;
        }
       
        .germany:after
        {
            background-image: url("vacation.jpg");
            background-position: center;
        }
       
        .england:after
        {
            background-image: url("england.jpg");
            background-position: center;
        }
    </style>
</head>
<body>
    <div class="page-container">
        <div class="flex-container">
            <div class="country netherlands">
                <div>
                    Netherlands</div>
            </div>
            <div class="country belgium">
                <div>
                    Belgium</div>
            </div>
            <div class="country france">
                <div>
                    France</div>
            </div>
            <div class="country germany">
                <div>
                    Germany</div>
            </div>
            <div class="country england">
                <div>
                    England</div>
            </div>
        </div>
    </div>
    <script src='jquery.js'></script>
    <script>
        $('.country').click(function () {
            $(this).toggleClass('active');
            $('.page-container').toggleClass('opened');
        }); //@ sourceURL=pen.js
    </script>
</body>
</html>

完整实例代码点击此处本站下载

希望本文所述对大家的jQuery特效设计有所帮助。

(0)

相关推荐

  • jquery手风琴特效插件

    手风琴效果是项目中使用频率较高的一种效果,原来项目一直都在用easyui的,临近年末,试着自己写了一个 css样式 复制代码 代码如下: /* CSS Document */ body {     margin: 0 auto;     padding: 0 auto;     font-size: 9pt;     font-family: 微软雅黑, 宋体, Arial, Helvetica, Verdana, sans-serif; } .accordion {     padding-l

  • 基于JQuery的一句话搞定手风琴菜单

    一.Html代码 复制代码 代码如下: <div class="MenuSubTitle AccordionCollapse">子菜单1</div> <div> <a href="Fld_BaseData/aa.aspx">aa管理</a><br/> <a href="Fld_BaseData/bb.aspx">bb管理</a><br/>

  • jquery实现手风琴效果

    本文实例讲述了jquery实现手风琴效果的代码.分享给大家供大家参考.具体如下: 效果过程就是当鼠标覆盖图片时,这张图片的宽度变大,其他兄弟图片宽度变小,效果如下: 具体代码如下 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns=&qu

  • 基于Jquery代码实现手风琴菜单

    先给大家展示效果图: 先看页面代码,列表的嵌套: <div id="menuDiv"> <ul id="menu"> <li class="parentLi"> <span>B</span> <ul class="childrenUl"> <li class="childrenLi"><span>C</sp

  • jquery插件制作 手风琴Panel效果实现

    首先我们还是创建一个html文件,里面包含如下的html结构. 复制代码 代码如下: <div id="pane-container"> <div class="pane"> <h1>first pane</h1> <p>this script should allow only one pane to be visible at a time.</p> </div> <div

  • 简单实现jQuery手风琴效果

    本文实例为大家分享了jQuery实现手风琴效果的具体代码,供大家参考,具体内容如下 js代码: <script type="text/javascript" src="jquery-3.0.0.js"></script> <script type="text/javascript"> $(function() { //获取所有li遍历 $(".li_list").each(function(

  • 基于jquery的slideDown和slideUp做手风琴

    手风琴 *{ padding:0; margin:0; } body{ background:#fafafa; font-size:12px; } .slider{ line-height:24px; width:700px; color:#7ecef4; margin:10px auto; background:#010e16; } .slider dt{ background:#f5f5d2; padding-left:30px; cursor:pointer; overflow:hidde

  • jQuery制作效果超棒的手风琴折叠菜单

    拉风的jQuery制作的手风琴折叠菜单,效果非常不错!这里是之前版本的改进版,主要是jquery代码改进 演示图: main.js $(function(){ var tmp = null, $title = $('.title'), $con = $('.title > ul'); $title.click(function(){ $(tmp).children('ul').slideUp().end().children('.arrow').removeClass('arrow-up');

  • jquery实现手风琴效果实例代码

    复制代码 代码如下: //jquery实现手风琴效果  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  <html xmlns="http://www.w3.org/1999/xhtml">  <head>  <

  • jQuery Easyui使用(一)之可折叠面板的布局手风琴菜单

    先给大家看下效果图,效果图展示如下: 关键代码如下所示: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>首页</title> &l

随机推荐