基于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 相关文章推荐
JavaScript 页面编码与浏览器类型判断代码
Jun 03 Javascript
jquery 回车事件实现代码
Aug 23 Javascript
JavaScript高级程序设计 客户端存储学习笔记
Sep 10 Javascript
解决jquery submit()提交表单提示:f[s] is not a function
Jan 23 Javascript
node.js使用require()函数加载模块
Nov 26 Javascript
node.js+Ajax实现获取HTTP服务器返回数据
Nov 26 Javascript
jQuery 重复加载错误以及修复方法
Dec 16 Javascript
Bootstrap教程JS插件弹出框学习笔记分享
May 17 Javascript
AngularJS 实现购物车全选反选功能
Oct 24 Javascript
js原生实现移动端手指滑动轮播图效果的示例
Jan 02 Javascript
详解js模板引擎art template数组渲染的方法
Oct 09 Javascript
微信小程序实现点击图片旋转180度并且弹出下拉列表
Nov 27 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
天使彦史上最神还原,性别曝光的那一刻,百万网友恋爱了
2020/03/02 国漫
声音就能俘获人心,蕾姆,是哪个漂亮小姐姐配音呢?
2020/03/03 日漫
如何跨站抓取别的站点的页面的补充
2006/10/09 PHP
巧用php中的array_filter()函数去掉多维空值的代码分享
2012/09/07 PHP
fetchAll()与mysql_fetch_array()的区别详解
2013/06/05 PHP
PHP页面间参数传递的四种方法详解
2013/06/09 PHP
php获取网页里所有图片并存入数组的方法
2015/04/06 PHP
如何解决PHP无法实现多线程的问题
2015/09/25 PHP
Laravel实现自定义错误输出内容的方法
2016/10/10 PHP
PHP中Static(静态)关键字功能与用法实例分析
2019/04/05 PHP
JS文本框不能输入空格验证方法
2013/03/19 Javascript
JS获取当前日期时间并定时刷新示例
2021/03/04 Javascript
JavaScript中this详解
2015/09/01 Javascript
AngularJS过滤器详解及示例代码
2016/08/16 Javascript
清除js缓存的多种方法总结
2016/12/09 Javascript
angularjs中ng-attr的用法详解
2016/12/31 Javascript
JavaScript中for循环的几种写法与效率总结
2017/02/03 Javascript
Vue组件模板形式实现对象数组数据循环为树形结构(实例代码)
2017/07/31 Javascript
bootstrap里bootstrap动态加载下拉框的实例讲解
2018/08/10 Javascript
Vue中使用clipboard实现复制功能
2018/09/05 Javascript
ES6 十大特性简介
2020/12/09 Javascript
简单了解OpenCV是个什么东西
2017/11/10 Python
Python数据分析之双色球基于线性回归算法预测下期中奖结果示例
2018/02/08 Python
python绘制多个曲线的折线图
2020/03/23 Python
python看某个模块的版本方法
2018/10/16 Python
Python如何合并多个字典或映射
2020/07/24 Python
HTML5 canvas绘制的玫瑰花效果
2014/05/29 HTML / CSS
西班牙创意礼品和小工具网上商店:Curiosite
2016/07/26 全球购物
在什么时候需要使用"常引用"
2015/12/31 面试题
毕业生求职的求职信
2013/12/05 职场文书
高中运动会入场词
2014/02/14 职场文书
求职简历自我评价范例
2014/03/12 职场文书
设备售后服务承诺书
2014/05/30 职场文书
2015年保险公司工作总结
2015/04/24 职场文书
2015年税务稽查工作总结
2015/05/26 职场文书
大学生创业计划书常用模板
2019/08/07 职场文书