|
59 | 59 | // Either set true/false, or an object with the HTML
|
60 | 60 | // elements for each arrow like below:
|
61 | 61 | arrows: {
|
62 |
| - prev: '<a class="' + self._ + '-arrow prev">←</a>', |
63 |
| - next: '<a class="' + self._ + '-arrow next">→</a>' |
| 62 | + prev: '<a class="' + self._ + '-arrow prev">Prev</a>', |
| 63 | + next: '<a class="' + self._ + '-arrow next">Next</a>' |
64 | 64 | },
|
65 | 65 |
|
66 | 66 | // How should Unslider animate?
|
|
135 | 135 | });
|
136 | 136 |
|
137 | 137 | // Add swipe support
|
138 |
| - if(typeof jQuery.event.special.swipe !== undefined && self.options.swipe) { |
| 138 | + if(jQuery.event.special.swipe && self.options.swipe) { |
139 | 139 | self.initSwipe();
|
140 | 140 | }
|
141 | 141 |
|
|
380 | 380 | self.current = Math.min(Math.max(0, to), self.total - 1);
|
381 | 381 |
|
382 | 382 | if(self.options.nav) {
|
383 |
| - self.$nav.find('[data-slide="' + self.current + '"]')._toggleActive(self.options.activeClass); |
| 383 | + self.$nav.find('[data-slide="' + self.current + '"]')._active(self.options.activeClass); |
384 | 384 | }
|
385 | 385 |
|
386 |
| - self.$slides.eq(self.current)._toggleActive(self.options.activeClass); |
| 386 | + self.$slides.eq(self.current)._active(self.options.activeClass); |
387 | 387 |
|
388 | 388 | return self;
|
389 | 389 | };
|
|
571 | 571 | // They're both just helpful types of shorthand for
|
572 | 572 | // anything that might take too long to write out or
|
573 | 573 | // something that might be used more than once.
|
574 |
| - $.fn._toggleActive = function(className) { |
| 574 | + $.fn._active = function(className) { |
575 | 575 | return this.addClass(className).siblings().removeClass(className);
|
576 | 576 | };
|
577 | 577 |
|
|
587 | 587 | };
|
588 | 588 |
|
589 | 589 | $.fn._move = function() {
|
590 |
| - var type = 'animate'; |
591 |
| - |
592 | 590 | this.stop(true, true);
|
593 |
| - |
594 |
| - if($.fn.velocity) { |
595 |
| - type = 'velocity'; |
596 |
| - } |
597 |
| - |
598 |
| - return $.fn[type].apply(this
67F4
, arguments); |
| 591 | + return $.fn[$.fn.velocity ? 'velocity' : 'animate'].apply(this, arguments); |
599 | 592 | };
|
600 | 593 |
|
601 | 594 | // And set up our jQuery plugin
|
|
609 | 602 | if(typeof opts === 'string' && $this.data('unslider')) {
|
610 | 603 | opts = opts.split(':');
|
611 | 604 |
|
612 |
| - var fn = opts[0]; |
613 |
| - var call = $this.data('unslider')[fn]; |
| 605 | + var call = $this.data('unslider')[opts[0]]; |
614 | 606 |
|
615 | 607 | // Do we have arguments to pass to the string-function?
|
616 |
| - if(opts[1]) { |
617 |
| - var args = opts[1].split(','); |
618 |
| - return $.isFunction(call) && call.apply($this, args); |
619 |
| - } |
620 |
| - |
621 |
| - $.isFunction(call) && call(); |
622 |
| - |
623 |
| - return this; |
| 608 | + $.isFunction(call) && call.apply($this, args ? null : opts[1].split(',')); |
624 | 609 | }
|
625 | 610 |
|
626 | 611 | return $this.data('unslider', new $.Unslider($this, opts));
|
|
0 commit comments