基于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 相关文章推荐
form中限制文本字节数js代码
Jun 10 Javascript
defer属性导致引用JQuery的页面报“浏览器无法打开网站xxx,操作被中止”错误的解决方法
Apr 27 Javascript
javascript之典型高阶函数应用介绍二
Jan 10 Javascript
JavaScript计算两个日期时间段内日期的方法
Mar 16 Javascript
深入理解JavaScript中的call、apply、bind方法的区别
May 30 Javascript
Bootstrap实现带暂停功能的轮播组件(推荐)
Nov 25 Javascript
快速解决angularJS中用post方法时后台拿不到值的问题
Aug 14 Javascript
浅谈React Event实现原理
Sep 20 Javascript
vue移动端html5页面根据屏幕适配的四种解决方法
Oct 19 Javascript
vue使用@scroll监听滚动事件时,@scroll无效问题的解决方法详解
Oct 15 Javascript
JavaScript实现京东放大镜效果
Dec 03 Javascript
三剑客:offset、client和scroll还傻傻分不清?
Dec 04 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处理Oracle的CLOB实例
2014/11/03 PHP
jquery+php实现导出datatables插件数据到excel的方法
2015/07/06 PHP
PHP针对中英文混合字符串长度判断及截取方法示例
2017/03/31 PHP
点击广告后才能获得下载地址
2006/10/26 Javascript
jQuery 美元符冲突的解决方法
2010/03/28 Javascript
js判断IE浏览器版本过低示例代码
2013/11/22 Javascript
Window.Open如何在同一个标签页打开
2014/06/20 Javascript
js中this用法实例详解
2015/05/05 Javascript
JQuery创建DOM节点的方法
2015/06/11 Javascript
谈谈JSON对象和字符串之间的相互转换JSON.stringify(obj)和JSON.parse(string)
2015/10/01 Javascript
node.js入门教程之querystring模块的使用方法
2017/02/27 Javascript
JS自动生成动态HTML验证码页面
2017/06/14 Javascript
Angular 2父子组件数据传递之@Input和@Output详解(下)
2017/07/05 Javascript
react-native 封装选择弹出框示例(试用ios&amp;android)
2017/07/11 Javascript
详解Vue中数组和对象更改后视图不刷新的问题
2018/09/21 Javascript
JavaScript展开操作符(Spread operator)详解
2019/07/20 Javascript
windows下ipython的安装与使用详解
2016/10/20 Python
对python 各种删除文件失败的处理方式分享
2018/04/24 Python
Python实现的查询mysql数据库并通过邮件发送信息功能
2018/05/17 Python
浅析python继承与多重继承
2018/09/13 Python
pyqt 多窗口之间的相互调用方法
2019/06/19 Python
Django结合ajax进行页面实时更新的例子
2019/08/12 Python
Tensorflow实现部分参数梯度更新操作
2020/01/23 Python
Python run()函数和start()函数的比较和差别介绍
2020/05/03 Python
浅谈Tensorflow加载Vgg预训练模型的几个注意事项
2020/05/26 Python
HTML5实现的图片无限加载的瀑布流效果另带边框圆角阴影
2014/03/07 HTML / CSS
html5使用window.postMessage进行跨域实现数据交互的一次实战
2021/02/24 HTML / CSS
英国马莎百货印度官网:Marks & Spencer印度
2020/10/08 全球购物
战略合作意向书范本
2014/04/01 职场文书
信息管理专业自荐书
2014/06/05 职场文书
农村党支部书记司法四风问题对照检查材料
2014/09/26 职场文书
2015年毕业实习工作总结
2014/12/12 职场文书
新郎父母婚礼答谢词
2015/09/29 职场文书
用人单位的规章制度,怎样制定才是有效的?
2019/07/09 职场文书
导游词之上海东方明珠塔
2019/09/25 职场文书
PHP设计模式(观察者模式)
2021/07/07 PHP