SWATCH BOOK 是一款用css3和jquery打造的动画色票插件。其中用到了css的旋转变换,每个色票都是可以点击的,当我们点击某个色票时,为了完全显示该色票,其他的色票将会被旋转开。注意:该插件只能运行在支持css3的浏览器中。
width="474" height="300" title="色票插件" alt="色票插件"/>
alt=""/>
alt=""/>
1、引入以下的js和css文件
1 2 3 4 | < link rel = "stylesheet" type = "text/css" href = "css/style.css" >、 < script type = "text/javascript" src = "js/modernizr.custom.79639.js" ></ script > < script type = "text/javascript" src = "js/jquery.min.js" ></ script > < script type = "text/javascript" src = "js/jquery.swatchbook.js" ></ script > |
2、在head标签中加入以下js代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | < script type = "text/javascript" > $(function() { $( '#sb-container' ).swatchbook(); }); </ pre > < br /> 3、在body标签中加入以下格式的html代码< br /> < pre class = "brush:html;toolbar:false" > < div id = "sb-container" class = "sb-container" > < div > < span class = "sb-icon icon-cog" ></ span > < h4 > < span >All Settings</ span > </ h4 > </ div > < div > < span class = "sb-icon icon-flight" ></ span > < h4 > < span >User Modes</ span > </ h4 > </ div > < div > <!-- ... --> </ div > <!-- ... --> < div > < h4 > < span >Profile</ span > </ h4 > < h5 > < span >We ? color</ span > </ h5 > </ div > </ div > </ pre > < br /> < p > 当然以上是demo1的源码,大家可以查看示例下载中自己喜欢的样式的html文件即可。 </ p > < p > < br /> </ p > < h3 > 参数配置 </ h3 > 官方给出了相应的参数配置,如下。< br /> < pre class = "brush:html;toolbar:false" > $.SwatchBook.defaults = { // index of initial centered item center : 6, // number of degrees that is between each item angleInc : 8, speed : 700, easing : 'ease', // amount in degrees for the opened item's next sibling proximity : 45, // amount in degrees between the opened item's next siblings neighbor : 4, // animate on load onLoadAnim : true, // if it should be closed by default initclosed : false, // index of the element that when clicked, triggers the open/close function // by default there is no such element closeIdx : -1, // open one specific item initially (overrides initclosed) openAt : -1 }; </ pre > < br /> < p > < br /> </ p > < h3 > 下载地址 </ h3 > 网盘下载:< a href = "http://pan.baidu.com/share/link?shareid=330674&uk=2166814920" target = "_blank" >http://pan.baidu.com/share/link?shareid=330674&uk=2166814920</ a >< br /> </ script > |
官方给出了相应的参数配置,如下。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | $.SwatchBook.defaults = { // index of initial centered item center : 6, // number of degrees that is between each item angleInc : 8, speed : 700, easing : 'ease', // amount in degrees for the opened item's next sibling proximity : 45, // amount in degrees between the opened item's next siblings neighbor : 4, // animate on load onLoadAnim : true, // if it should be closed by default initclosed : false, // index of the element that when clicked, triggers the open/close function // by default there is no such element closeIdx : -1, // open one specific item initially (overrides initclosed) openAt : -1 }; |
特别申明:
本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com