图片/图形

jQuery+css3洗牌图片切换特效

阿里云


jquery.baraja 是一个很有意思的 jquery 洗牌图片切换插件。这个洗牌图片切换插件将图片堆叠在一起像一幅扑克一样,点击按钮可以将它展开,最下面的图片被切换到上面,展开时也可以选择其中一张放到最上面。Baraja 是一个很有趣的 jQuery 插件。它允许你像在桌子上摊开扑克牌一样将元素展开和收缩。它使用 CSS transforms 来旋转和 translate 这些元素。它使用几个可用参数来控制各种不同的展开效果,比如横向移动扑克牌并像开扇子一样旋转它们。

HTML 结构:

要使用 jquery.Baraja 插件,必须使用一个无序列表,并给它一个 classbaraja-container。

也想出现在这里?联系我们
创客主机
  1. <ul id="baraja-el" class="baraja-container">
  2.     <li>
  3.         <img src="images/1.jpg" alt="image1"/>
  4.         <h4>Coco Loko</h4>
  5.         <p>Total bicycle rights in blog four loko raw denim ex, helvetica sapiente odio placeat.</p>
  6.     </li>
  7.     <li> <!-- ... --> </li>
  8.     <li> <!-- ... --> </li>
  9.     <li> <!-- ... --> </li>
  10.     <!-- ... -->
  11. </ul>

调用插件:

  1. $( '#baraja-el' ).baraja();

下面是一个使用了参数的例子:

  1. $( '#some-button' ).on( 'click', function( event ) {
  2.  
  3.     baraja.fan( {
  4.         speed : 500,
  5.         easing : 'ease-out',
  6.         range : 90,
  7.         direction : 'right',
  8.         origin : { x : 25, y : 100 },
  9.         center : true,
  10.         translation : 0
  11.     } );
  12.  
  13. } );

可选参数

下面列出了可用的默认参数:

  1. $.Baraja.defaults = {
  2.     // if we want to specify a selector that triggers the next() function. example: '#baraja-nav-next'
  3.     nextEl : '',
  4.     // if we want to specify a selector that triggers the previous() function
  5.     prevEl : '',
  6.     // default transition speed
  7.     speed : 300,
  8.     // default transition easing
  9.     easing : 'ease-in-out'
  10. };

可用的方法有:fan(), next(), previous(), close(), add(),将扑克牌设置为扇形的方法如下:

  1. this.fanSettings = {
  2.     // speed for opening/closing
  3.     speed : 500,
  4.     // easing for opening/closing
  5.     easing : 'ease-out',
  6.     // difference/range of possible angles that the items will have
  7.     // example: with range:90 and center:false the first item
  8.     // will have 0deg and the last one 90deg;
  9.     // if center:true, then the first one will have 45deg
  10.     // and the last one -45deg; in both cases the difference is 90deg
  11.     range : 90,
  12.     // this defines the position of the first item 
  13.     // (to the right, to the left)
  14.     // and its angle (clockwise / counterclockwise)
  15.     direction : 'right',
  16.     // transform origin:
  17.     // you can also pass a minX and maxX, meaning the left value 
  18.     // will vary between minX and maxX 
  19.     origin : { x : 25, y : 100 },
  20.     // additional translation of each item
  21.     translation : 0,
  22.     // if the cards should be centered after the transform 
  23.     // is applied
  24.     center : true,
  25.     // add a random factor to the final transform
  26.     scatter : false
  27. };

基本的样式都写在 baraja.css 文件中。在下载包中列举了许多不同的例子,你可以下载来研究他们。

jQuery+css3 洗牌图片切换特效

已有 398 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!