---
title: "带标题 有小圆点计数 左右翻页的焦点图 不同的效果"
author: "freejs"
date: "2014-11-02T15:40:57Z"
tags: []
categories: ["Web前端"]
slug: "untitled"
draft: false
lastmod: "2014-11-02T15:40:57Z"
id: 2151506
url: "https://freejs.iteye.com/blog/2151506"
---

## 带标题 有小圆点计数 左右翻页的焦点图 不同的效果

 

![带标题 有小圆点计数 左右翻页的焦点图 不同的效果](http://www.freejs.net/demo/307/demo.jpg "带标题 有小圆点计数 左右翻页的焦点图 不同的效果")

[演示](http://www.freejs.net/demo/307/index.html "带标题 有小圆点计数 左右翻页的焦点图 不同的效果")

 

XML/HTML Code

01. &lt;section&gt;
02. &lt;div class="title"&gt;
03. &lt;!--&lt;h3&gt;» default&lt;/h3&gt;--&gt;
04. &lt;label&gt;Effect:&lt;/label&gt;
05. &lt;select id="effects-select"&gt;
06. &lt;option value="default"&gt;default&lt;/option&gt;
07. &lt;option value="simple"&gt;simple&lt;/option&gt;
08. &lt;option value="left"&gt;left&lt;/option&gt;
09. &lt;option value="up"&gt;up&lt;/option&gt;
10. &lt;option value="leftright"&gt;leftright&lt;/option&gt;
11. &lt;option value="updown"&gt;updown&lt;/option&gt;
12. &lt;option value="switchlr"&gt;switchlr&lt;/option&gt;
13. &lt;option value="switchud"&gt;switchud&lt;/option&gt;
14. &lt;option value="fliplr"&gt;fliplr&lt;/option&gt;
15. &lt;option value="flipud"&gt;flipud&lt;/option&gt;
16. &lt;option value="reduce"&gt;reduce&lt;/option&gt;
17. &lt;option value="360"&gt;360&lt;/option&gt;
18. &lt;/select&gt;
19. &lt;div class="code"&gt;
20. &lt;code&gt;x: 6&lt;/code&gt;
21. &lt;code&gt;y: 4&lt;/code&gt;
22. &lt;code&gt;random: true&lt;/code&gt;
23. &lt;/div&gt;
24. &lt;button type="button" class="start action"&gt;Play&lt;/button&gt;
25. &lt;button type="button" class="stop action"&gt;Stop&lt;/button&gt;
26. &lt;/div&gt;
27. &lt;div class="slider-wrap"&gt;
28. &lt;div class="slider"&gt;
29. &lt;p&gt;&lt;strong&gt;Pig ham:&lt;/strong&gt; hock pork loin brisket pastrami frankfurter andouille.&lt;/p&gt;
30. &lt;img src="img/img01.jpg"/&gt;&lt;p&gt;&lt;strong&gt;Sausage:&lt;/strong&gt; ground round sirloin ball tip beef ribs.&lt;/p&gt;
31. &lt;img src="img/img02.jpg"/&gt;&lt;p&gt;&lt;strong&gt;Pig ham:&lt;/strong&gt; hock pork loin brisket pastrami frankfurter andouille.&lt;/p&gt;
32. &lt;img src="img/img03.jpg"/&gt;&lt;p&gt;&lt;strong&gt;Pork turkey:&lt;/strong&gt; shoulder, filet mignon chuck t-bone bacon.&lt;/p&gt;
33. &lt;/div&gt;
34. &lt;/div&gt;
35. &lt;/section&gt;
36. &lt;script&gt;
37. var $slider = $('.slider-wrap');
38. var html = $slider.html();
39. // Options
40. var defaults = {
41. thumbSize: 20,
42. onSlideshowEnd: function(){ $('.stop, .start').toggle() }
43. };
44. var effects = {
45. 'default': { x:6, y:4, random: true },
46. simple: { x:6, y:4, effect: 'simple', random: true },
47. left: { x:1, y:8, effect: 'left' },
48. up: { x:20, y:1, effect: 'up', rewind: 60, backReverse: true },
49. leftright: { x:1, y:8, effect: 'leftright' },
50. updown: { x:20, y:1, effect: 'updown', cssSpeed: 500, backReverse: true },
51. switchlr: { x:20, y:1, effect: 'switchlr', backReverse: true },
52. switchud: { x:1, y:8, effect: 'switchud' },
53. fliplr: { x:20, y:1, effect: 'fliplr', backReverse: true },
54. flipud: { x:20, y:3, effect: 'flipud', reverse: true, rewind: 75 },
55. reduce: { x:6, y:4, effect: 'reduce' },
56. 360: { x:1, y:1, effect: '360', fade: true, cssSpeed: 600 }
57. };
58. $('#effects-select').change(function() {
59. var effect = $(this).val();
60. $slider.fadeTo( 0,0 ).html( html );
61. $('.stop').hide();
62. $('.start').show();
63. setTimeout(function() {
64. $('.slider').tilesSlider( $.extend( {}, defaults, effects\[ effect ] ) );
65. $slider.fadeTo( 0,1 );
66. $('body').removeClass('tiles-preload');
67. }, 100 );
68. $('.code').empty().html(function() {
69. var e = effects\[ effect ], c = \[];
70. for ( var i in e ) {
71. if ( i !== 'effect' ) {
72. c.push('&lt;code&gt;'+ i +': '+ e\[i] +'&lt;/code&gt;');
73. }
74. }
75. return c.join('');
76. });
77. });
78. $('.start').click(function() {
79. $(this).hide();
80. $('.stop').show();
81. $('.slider').tilesSlider('start')
82. });
83. $('.stop').click(function() {
84. $(this).hide();
85. $('.start').show()
86. $('.slider').tilesSlider('stop')
87. });
88. $('.slider').tilesSlider( $.extend( {}, defaults, effects\['default'] ) );
89. &lt;/script&gt;

 

原文地址:[http://www.freejs.net/article\_jiaodiantu\_307.html](http://www.freejs.net/article_jiaodiantu_307.html)