本文实例讲述了基于jquery的手风琴图片展示效果实现方法。分享给大家供大家参考。具体实现方法如下: 代码运行效果如下图所示: index.html页面代码如下: 复制代码 代码如下: 一款基于jquery的手风琴图片展示效果demo <br /> div<br /> {<br /> -moz-box-sizing: border-box;<br /> box-sizing: border-box;<br /> }<br /> <br /> html, body, .page-container<br /> {<br /> height: 100%;<br /> overflow: hidden;<br /> }<br /> <br /> .page-container<br /> {<br /> -webkit-transition: padding 0.2s ease-in;<br /> transition: padding 0.2s ease-in;<br /> padding: 80px;<br /> }<br /> .page-container.opened<br /> {<br /> padding: 0;<br /> }<br /> .page-container.opened .flex-container .country:not(.active)<br /> {<br /> opacity: 0;<br /> -webkit-flex: 0;<br /> -ms-flex: 0;<br /> flex: 0;<br /> }<br /> .page-container.opened .flex-container .country:not(.active) div<br /> {<br /> opacity: 0;<br /> }<br /> .page-container.opened .flex-container .active:after<br /> {<br /> -webkit-filter: grayscale(0%) !important;<br /> filter: grayscale(0%) !important;<br /> }<br /> <br /> .flex-container<br /> {<br /> display: -webkit-flex;<br /> display: -ms-flexbox;<br /> display: flex;<br /> height: 100%;<br /> }<br /> @media all and (max-width: 900px)<br /> {<br /> .flex-container<br /> {<br /> -webkit-flex-direction: column;<br /> -ms-flex-direction: column;<br /> flex-direction: column;<br /> }<br /> }<br /> <br /> .country<br /> {<br /> position: relative;<br /> -webkit-flex-grow: 1;<br /> -ms-flex-positive: 1;<br /> flex-grow: 1;<br /> -webkit-flex: 1;<br /> -ms-flex: 1;<br /> flex: 1;<br /> -webkit-transition: 0.5s ease-in-out;<br /> transition: 0.5s ease-in-out;<br /> cursor: pointer;<br /> font-family: "Bree Serif" , serif;<br /> text-align: center;<br /> color: #fff;<br /> font-size: 22px;<br /> text-shadow: 0 0 3px #000;<br /> }<br /> .country div<br /> {<br /> position: absolute;<br /> width: 100%;<br /> z-index: 10;<br /> top: 50%;<br /> text-align: center;<br /> -webkit-transition: 0.1s;<br /> transition: 0.1s;<br /> -webkit-transform: translateY(-50%);<br /> -ms-transform: translateY(-50%);<br /> transform: translateY(-50%);<br /> -webkit-filter: none;<br /> filter: none;<br /> }<br /> .country:after<br /> {<br /> content: " ";<br /> position: absolute;<br /> top: 0;<br /> left: 0;<br /> right: 0;<br /> bottom: 0;<br /> background-size: cover;<br /> -webkit-transition: 0.5s ease-in-out;<br /> transition: 0.5s ease-in-out;<br /> -webkit-filter: grayscale(100%);<br /> filter: grayscale(100%);<br /> }<br /> .country:hover<br /> {<br /> -webkit-flex-grow: 6;<br /> -ms-flex-positive: 6;<br /> flex-grow: 6;<br /> }<br /> .country:hover:after<br /> {<br /> -webkit-filter: grayscale(0%);<br /> filter: grayscale(0%);<br /> }<br /> @media all and (max-width: 900px)<br /> {<br /> .country<br /> {<br /> height: auto;<br /> }<br /> }<br /> <br /> .netherlands:after<br /> {<br /> background-image: url("Netherlands.png");<br /> background-position: center;<br /> }<br /> <br /> .belgium:after<br /> {<br /> background-image: url("belgium-307_3.jpg");<br /> background-position: center;<br /> }<br /> <br /> .france:after<br /> {<br /> background-image: url("30.jpg");<br /> background-position: center;<br /> }<br /> <br /> .germany:after<br /> {<br /> background-image: url("vacation.jpg");<br /> background-position: center;<br /> }<br /> <br /> .england:after<br /> {<br /> background-image: url("england.jpg");<br /> background-position: center;<br /> }<br /> Netherlands Belgium France Germany England <br /> $('.country').click(function () {<br /> $(this).toggleClass('active');<br /> $('.page-container').toggleClass('opened');<br /> }); //@ sourceURL=pen.js<br /> 完整实例代码点击此处本站下载。 希望本文所述对大家的jQuery特效设计有所帮助。