Subversion-Projekte lars-tiefland.cienc

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
8 lars 1
#bxSlider 4.1.2
2
##The fully-loaded, responsive jQuery content slider
3
 
4
###Why should I use this slider?
5
* Fully responsive - will adapt to any device
6
* Horizontal, vertical, and fade modes
7
* Slides can contain images, video, or HTML content
8
* Full callback API and public methods
9
* Small file size, fully themed, simple to implement
10
* Browser support: Firefox, Chrome, Safari, iOS, Android, IE7+
11
* Tons of configuration options
12
 
13
For complete documentation, tons of examples, and a good time, visit:
14
 
15
[http://bxslider.com](http://bxslider.com)
16
 
17
Written by: Steven Wanderski - [http://stevenwanderski.com](http://stevenwanderski.com)
18
 
19
###License
20
Released under the MIT license - http://opensource.org/licenses/MIT
21
 
22
Let's get on with it!
23
 
24
##Installation
25
 
26
###Step 1: Link required files
27
 
28
First and most important, the jQuery library needs to be included (no need to download - link directly from Google). Next, download the package from this site and link the bxSlider CSS file (for the theme) and the bxSlider Javascript file.
29
 
30
```html
31
<!-- jQuery library (served from Google) -->
32
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
33
<!-- bxSlider Javascript file -->
34
<script src="/js/jquery.bxslider.min.js"></script>
35
<!-- bxSlider CSS file -->
36
<link href="/lib/jquery.bxslider.css" rel="stylesheet" />
37
```
38
 
39
###Step 2: Create HTML markup
40
 
41
Create a `<ul class="bxslider">` element, with a `<li>` for each slide. Slides can contain images, video, or any other HTML content!
42
 
43
```html
44
<ul class="bxslider">
45
  <li><img src="/images/pic1.jpg" /></li>
46
  <li><img src="/images/pic2.jpg" /></li>
47
  <li><img src="/images/pic3.jpg" /></li>
48
  <li><img src="/images/pic4.jpg" /></li>
49
</ul>
50
```
51
 
52
###Step 3: Call the bxSlider
53
 
54
Call .bxslider() on `<ul class="bxslider">`. Note that the call must be made inside of a $(document).ready() call, or the plugin will not work!
55
 
56
```javascript
57
$(document).ready(function(){
58
  $('.bxslider').bxSlider();
59
});
60
```
61
 
62
##Configuration options
63
 
64
###General
65
 
66
**mode**
67
Type of transition between slides
68
```
69
default: 'horizontal'
70
options: 'horizontal', 'vertical', 'fade'
71
```
72
 
73
**speed**
74
Slide transition duration (in ms)
75
```
76
default: 500
77
options: integer
78
```
79
 
80
**slideMargin**
81
Margin between each slide
82
```
83
default: 0
84
options: integer
85
```
86
 
87
**startSlide**
88
Starting slide index (zero-based)
89
```
90
default: 0
91
options: integer
92
```
93
 
94
**randomStart**
95
Start slider on a random slide
96
```
97
default: false
98
options: boolean (true / false)
99
```
100
 
101
**slideSelector**
102
Element to use as slides (ex. <code>'div.slide'</code>).<br />Note: by default, bxSlider will use all immediate children of the slider element
103
```
104
default: ''
105
options: jQuery selector
106
```
107
 
108
**infiniteLoop**
109
If <code>true</code>, clicking "Next" while on the last slide will transition to the first slide and vice-versa
110
```
111
default: true
112
options: boolean (true / false)
113
```
114
 
115
**hideControlOnEnd**
116
If <code>true</code>, "Prev" and "Next" controls will receive a class <code>disabled</code> when slide is the first or the last<br/>Note: Only used when <code>infiniteLoop: false</code>
117
```
118
default: false
119
options: boolean (true / false)
120
```
121
 
122
**easing**
123
The type of "easing" to use during transitions. If using CSS transitions, include a value for the <code>transition-timing-function</code> property. If not using CSS transitions, you may include <code>plugins/jquery.easing.1.3.js</code> for many options.<br />See <a href="http://gsgd.co.uk/sandbox/jquery/easing/" target="_blank">http://gsgd.co.uk/sandbox/jquery/easing/</a> for more info.
124
```
125
default: null
126
options: if using CSS: 'linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out', 'cubic-bezier(n,n,n,n)'. If not using CSS: 'swing', 'linear' (see the above file for more options)
127
```
128
 
129
**captions**
130
Include image captions. Captions are derived from the image's <code>title</code> attribute
131
```
132
default: false
133
options: boolean (true / false)
134
```
135
 
136
**ticker**
137
Use slider in ticker mode (similar to a news ticker)
138
```
139
default: false
140
options: boolean (true / false)
141
```
142
 
143
**tickerHover**
144
Ticker will pause when mouse hovers over slider. Note: this functionality does NOT work if using CSS transitions!
145
```
146
default: false
147
options: boolean (true / false)
148
```
149
 
150
**adaptiveHeight**
151
Dynamically adjust slider height based on each slide's height
152
```
153
default: false
154
options: boolean (true / false)
155
```
156
 
157
**adaptiveHeightSpeed**
158
Slide height transition duration (in ms). Note: only used if <code>adaptiveHeight: true</code>
159
```
160
default: 500
161
options: integer
162
```
163
 
164
**video**
165
If any slides contain video, set this to <code>true</code>. Also, include <code>plugins/jquery.fitvids.js</code><br />See <a href="http://fitvidsjs.com/" target="_blank">http://fitvidsjs.com/</a> for more info
166
```
167
default: false
168
options: boolean (true / false)
169
```
170
 
171
**responsive**
172
Enable or disable auto resize of the slider. Useful if you need to use fixed width sliders.
173
```
174
default: true
175
options: boolean (true /false)
176
```
177
 
178
**useCSS**
179
If true, CSS transitions will be used for horizontal and vertical slide animations (this uses native hardware acceleration). If false, jQuery animate() will be used.
180
```
181
default: true
182
options: boolean (true / false)
183
```
184
 
185
**preloadImages**
186
If 'all', preloads all images before starting the slider. If 'visible', preloads only images in the initially visible slides before starting the slider (tip: use 'visible' if all slides are identical dimensions)
187
```
188
default: 'visible'
189
options: 'all', 'visible'
190
```
191
 
192
**touchEnabled**
193
If <code>true</code>, slider will allow touch swipe transitions
194
```
195
default: true
196
options: boolean (true / false)
197
```
198
 
199
**swipeThreshold**
200
Amount of pixels a touch swipe needs to exceed in order to execute a slide transition. Note: only used if <code>touchEnabled: true</code>
201
```
202
default: 50
203
options: integer
204
```
205
 
206
**oneToOneTouch**
207
If <code>true</code>, non-fade slides follow the finger as it swipes
208
```
209
default: true
210
options: boolean (true / false)
211
```
212
 
213
**preventDefaultSwipeX**
214
If <code>true</code>, touch screen will not move along the x-axis as the finger swipes
215
```
216
default: true
217
options: boolean (true / false)
218
```
219
 
220
**preventDefaultSwipeY**
221
If <code>true</code>, touch screen will not move along the y-axis as the finger swipes
222
```
223
default: false
224
options: boolean (true / false)
225
```
226
 
227
**wrapperClass**
228
Class to wrap the slider in. Change to prevent from using default bxSlider styles.
229
```
230
default: 'bx-wrapper'
231
options: string
232
```
233
 
234
###Pager
235
 
236
**pager**
237
If <code>true</code>, a pager will be added
238
```
239
default: true
240
options: boolean (true / false)
241
```
242
 
243
**pagerType**
244
If <code>'full'</code>, a pager link will be generated for each slide. If <code>'short'</code>, a x / y pager will be used (ex. 1 / 5)
245
```
246
default: 'full'
247
options: 'full', 'short'
248
```
249
 
250
**pagerShortSeparator**
251
If <code>pagerType: 'short'</code>, pager will use this value as the separating character
252
```
253
default: ' / '
254
options: string
255
```
256
 
257
**pagerSelector**
258
Element used to populate the populate the pager. By default, the pager is appended to the bx-viewport
259
```
260
default: ''
261
options: jQuery selector
262
```
263
 
264
**pagerCustom**
265
Parent element to be used as the pager. Parent element must contain a <code>&lt;a data-slide-index="x"&gt;</code> element for each slide. See example <a href="/examples/thumbnail-method-1">here</a>. Not for use with dynamic carousels.
266
```
267
default: null
268
options: jQuery selector
269
```
270
 
271
**buildPager**
272
If supplied, function is called on every slide element, and the returned value is used as the pager item markup.<br />See <a href="http://bxslider.com/examples">examples</a> for detailed implementation
273
```
274
default: null
275
options: function(slideIndex)
276
```
277
 
278
###Controls
279
 
280
**controls**
281
If <code>true</code>, "Next" / "Prev" controls will be added
282
```
283
default: true
284
options: boolean (true / false)
285
```
286
 
287
**nextText**
288
Text to be used for the "Next" control
289
```
290
default: 'Next'
291
options: string
292
```
293
 
294
**prevText**
295
Text to be used for the "Prev" control
296
```
297
default: 'Prev'
298
options: string
299
```
300
 
301
**nextSelector**
302
Element used to populate the "Next" control
303
```
304
default: null
305
options: jQuery selector
306
```
307
 
308
**prevSelector**
309
Element used to populate the "Prev" control
310
```
311
default: null
312
options: jQuery selector
313
```
314
 
315
**autoControls**
316
If <code>true</code>, "Start" / "Stop" controls will be added
317
```
318
default: false
319
options: boolean (true / false)
320
```
321
 
322
**startText**
323
Text to be used for the "Start" control
324
```
325
default: 'Start'
326
options: string
327
```
328
 
329
**stopText**
330
Text to be used for the "Stop" control
331
```
332
default: 'Stop'
333
options: string
334
```
335
 
336
**autoControlsCombine**
337
When slideshow is playing only "Stop" control is displayed and vice-versa
338
```
339
default: false
340
options: boolean (true / false)
341
```
342
 
343
**autoControlsSelector**
344
Element used to populate the auto controls
345
```
346
default: null
347
options: jQuery selector
348
```
349
 
350
###Auto
351
 
352
**auto**
353
Slides will automatically transition
354
```
355
default: false
356
options: boolean (true / false)
357
```
358
 
359
**pause**
360
The amount of time (in ms) between each auto transition
361
```
362
default: 4000
363
options: integer
364
```
365
 
366
**autoStart**
367
Auto show starts playing on load. If <code>false</code>, slideshow will start when the "Start" control is clicked
368
```
369
default: true
370
options: boolean (true / false)
371
```
372
 
373
**autoDirection**
374
The direction of auto show slide transitions
375
```
376
default: 'next'
377
options: 'next', 'prev'
378
```
379
 
380
**autoHover**
381
Auto show will pause when mouse hovers over slider
382
```
383
default: false
384
options: boolean (true / false)
385
```
386
 
387
**autoDelay**
388
Time (in ms) auto show should wait before starting
389
```
390
default: 0
391
options: integer
392
```
393
 
394
###Carousel
395
 
396
**minSlides**
397
The minimum number of slides to be shown. Slides will be sized down if carousel becomes smaller than the original size.
398
```
399
default: 1
400
options: integer
401
```
402
 
403
**maxSlides**
404
The maximum number of slides to be shown. Slides will be sized up if carousel becomes larger than the original size.
405
```
406
default: 1
407
options: integer
408
```
409
 
410
**moveSlides**
411
The number of slides to move on transition. This value must be <code>>= minSlides</code>, and <code><= maxSlides</code>. If zero (default), the number of fully-visible slides will be used.
412
```
413
default: 0
414
options: integer
415
```
416
 
417
**slideWidth**
418
The width of each slide. This setting is required for all horizontal carousels!
419
```
420
default: 0
421
options: integer
422
```
423
 
424
###Callbacks
425
 
426
**onSliderLoad**
427
Executes immediately after the slider is fully loaded
428
```
429
default: function(){}
430
options: function(currentIndex){ // your code here }
431
arguments:
432
  currentIndex: element index of the current slide
433
```
434
 
435
**onSliderResize**
436
Executes immediately after the slider is resized
437
```
438
default: function(){}
439
options: function(currentIndex){ // your code here }
440
arguments:
441
  currentIndex: element index of the current slide
442
```
443
 
444
**onSlideBefore**
445
Executes immediately before each slide transition.
446
```
447
default: function(){}
448
options: function($slideElement, oldIndex, newIndex){ // your code here }
449
arguments:
450
  $slideElement: jQuery element of the destination element
451
  oldIndex: element index of the previous slide (before the transition)
452
  newIndex: element index of the destination slide (after the transition)
453
```
454
 
455
**onSlideAfter**
456
Executes immediately after each slide transition. Function argument is the current slide element (when transition completes).
457
```
458
default: function(){}
459
options: function($slideElement, oldIndex, newIndex){ // your code here }
460
arguments:
461
  $slideElement: jQuery element of the destination element
462
  oldIndex: element index of the previous slide (before the transition)
463
  newIndex: element index of the destination slide (after the transition)
464
```
465
 
466
**onSlideNext**
467
Executes immediately before each "Next" slide transition. Function argument is the target (next) slide element.
468
```
469
default: function(){}
470
options: function($slideElement, oldIndex, newIndex){ // your code here }
471
arguments:
472
  $slideElement: jQuery element of the destination element
473
  oldIndex: element index of the previous slide (before the transition)
474
  newIndex: element index of the destination slide (after the transition)
475
```
476
 
477
**onSlidePrev**
478
Executes immediately before each "Prev" slide transition. Function argument is the target (prev) slide element.
479
```
480
default: function(){}
481
options: function($slideElement, oldIndex, newIndex){ // your code here }
482
arguments:
483
  $slideElement: jQuery element of the destination element
484
  oldIndex: element index of the previous slide (before the transition)
485
  newIndex: element index of the destination slide (after the transition)
486
```
487
 
488
###Public methods
489
 
490
**goToSlide**
491
Performs a slide transition to the supplied slide index (zero-based)
492
```
493
example:
494
slider = $('.bxslider').bxSlider();
495
slider.goToSlide(3);
496
```
497
 
498
**goToNextSlide**
499
Performs a "Next" slide transition
500
```
501
example:
502
slider = $('.bxslider').bxSlider();
503
slider.goToNextSlide();
504
```
505
 
506
**goToPrevSlide**
507
Performs a "Prev" slide transition
508
```
509
example:
510
slider = $('.bxslider').bxSlider();
511
slider.goToPrevSlide();
512
```
513
 
514
**startAuto**
515
Starts the auto show. Provide an argument <code>false</code> to prevent the auto controls from being updated.
516
```
517
example:
518
slider = $('.bxslider').bxSlider();
519
slider.startAuto();
520
```
521
 
522
**stopAuto**
523
Stops the auto show. Provide an argument <code>false</code> to prevent the auto controls from being updated.
524
```
525
example:
526
slider = $('.bxslider').bxSlider();
527
slider.stopAuto();
528
```
529
 
530
**getCurrentSlide**
531
Returns the current active slide
532
```
533
example:
534
slider = $('.bxslider').bxSlider();
535
var current = slider.getCurrentSlide();
536
```
537
 
538
**getSlideCount**
539
Returns the total number of slides in the slider
540
```
541
example:
542
slider = $('.bxslider').bxSlider();
543
var slideQty = slider.getSlideCount();
544
```
545
 
546
**reloadSlider**
547
Reload the slider. Useful when adding slides on the fly. Accepts an optional settings object. <a href="/examples/reload-slider-settings">See here for an example.</a>
548
```
549
example:
550
slider = $('.bxslider').bxSlider();
551
slider.reloadSlider();
552
```
553
 
554
**destroySlider**
555
Destroy the slider. This reverts all slider elements back to their original state (before calling the slider).
556
```
557
example:
558
slider = $('.bxslider').bxSlider();
559
slider.destroySlider();
560
```
561
 
562
## Changelog
563
 
564
### Version 4.1.2
565
* Added `bower.json` configuration file. Manage bxSlider as a dependency using [bower](http://bower.io/).
566
 
567
### Version 4.1.1
568
* Removed imagesLoaded library and added iframe preloading support
569
* Added responsive option - setting to false will prevent $(window).resize binding
570
 
571
### Version 4.1
572
* Carousel mode (minSlides / maxSlides) was re-written to be more intuitive.
573
* SlideWidth now acts as it should (slides respect the width value).
574
* SlideWidth now properly parsed: accepts string ("600px") or integer (600).
575
* Slider now only needs to load visible slides (by default) in order to initialize which results in much faster loading. A "preloadImages" setting allows for configuration.
576
 
577
 
578
Long live Zep.