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


Posted in Javascript onDecember 16, 2014

本文实例讲述了基于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特效设计有所帮助。

Javascript 相关文章推荐
JS 字符串连接[性能比较]
May 10 Javascript
javascript 表单规则集合对象
Jul 21 Javascript
html 锁定页面(js遮罩层弹出div效果)
Oct 27 Javascript
jQuery操作CheckBox的方法介绍(选中,取消,取值)
Feb 04 Javascript
详解JavaScript数组和字符串中去除重复值的方法
Mar 07 Javascript
浅谈Javascript数据属性与访问器属性
Jul 26 Javascript
JS实现双击内容变为可编辑状态
Mar 03 Javascript
node+express+ejs使用模版引擎做的一个示例demo
Sep 18 Javascript
Node.js使用cookie保持登录的方法
May 11 Javascript
Vue+Element UI+vue-quill-editor富文本编辑器及插入图片自定义
Aug 20 Javascript
vue开发拖拽进度条滑动组件
Sep 21 Javascript
VueQuillEditor富文本上传图片(非base64)
Jun 03 Javascript
node.js中的fs.lchownSync方法使用说明
Dec 16 #Javascript
node.js中的fs.lchown方法使用说明
Dec 16 #Javascript
基于Bootstrap+jQuery.validate实现Form表单验证
Dec 16 #Javascript
node.js中的fs.fchmodSync方法使用说明
Dec 16 #Javascript
node.js中的fs.fchmod方法使用说明
Dec 16 #Javascript
node.js中的fs.lchmodSync方法使用说明
Dec 16 #Javascript
node.js中的fs.lchmod方法使用说明
Dec 16 #Javascript
You might like
PHP使用xmllint命令处理xml与html的方法
2014/12/15 PHP
php实现改变图片直接打开为下载的方法
2015/04/14 PHP
学习面向对象之面向对象的术语
2010/11/30 Javascript
js的一些常用方法小结
2011/06/29 Javascript
单击按钮显示隐藏子菜单经典案例
2013/01/04 Javascript
用js实现小球的自由移动代码
2013/04/22 Javascript
文字溢出实现溢出的部分再放入一个新生成的div中具体代码
2013/05/17 Javascript
jQuery设置与获取HTML,文本和值的简单实例
2014/02/26 Javascript
jQuery中$.ajax()和$.getJson()同步处理详解
2015/08/12 Javascript
jquery实现LED广告牌旋转系统图片切换效果代码分享
2015/08/26 Javascript
Bootstrap3制作自己的导航栏
2016/05/12 Javascript
基于BootStrap Metronic开发框架经验小结【八】框架功能总体界面介绍
2016/05/12 Javascript
对angularJs中2种自定义服务的实例讲解
2018/09/30 Javascript
vue组件tabbar使用方法详解
2018/11/06 Javascript
JS原形与原型链深入详解
2020/05/09 Javascript
[33:23]Secret vs Serenity 2018国际邀请赛小组赛BO2 第二场 8.16
2018/08/17 DOTA
Python实现多线程下载文件的代码实例
2014/06/01 Python
一个基于flask的web应用诞生 组织结构调整(7)
2017/04/11 Python
apache部署python程序出现503错误的解决方法
2017/07/24 Python
Python实现的计算器功能示例
2018/04/26 Python
Python OpenCV读取png图像转成jpg图像存储的方法
2018/10/28 Python
python数据分析工具之 matplotlib详解
2020/04/09 Python
使用jupyter notebook将文件保存为Markdown,HTML等文件格式
2020/04/14 Python
使用CSS3编写类似iOS中的复选框及带开关的按钮
2016/04/11 HTML / CSS
世界著名的顶级牛排:Omaha Steak(奥马哈牛排)
2016/09/20 全球购物
ORACLE十问
2015/04/20 面试题
公司新员工的演讲稿注意事项
2014/01/01 职场文书
英语专业个人求职信范文
2014/02/01 职场文书
安全生产一岗双责责任书
2014/07/28 职场文书
社区两委对照检查材料
2014/08/23 职场文书
少先队活动总结
2014/08/29 职场文书
师德师风主题教育活动总结
2015/05/07 职场文书
python中的被动信息搜集
2021/04/29 Python
python自动化测试通过日志3分钟定位bug
2021/11/20 Python
GO语言异常处理分析 err接口及defer延迟
2022/04/14 Golang
Redis基本数据类型Set常用操作命令
2022/06/01 Redis