Skip to content

Commit 9e9877b

Browse files
committed
Merge branch 'develop' of https://github.com/woothemes/FlexSlider into develop
2 parents 586eec4 + 0b84107 commit 9e9877b

File tree

2 files changed

+35
-29
lines changed

2 files changed

+35
-29
lines changed

demo/video-wistia.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212
<!-- Modernizr -->
1313
<script src="js/modernizr.js"></script>
1414

15+
<!-- jQuery -->
16+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
17+
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.min.js">\x3C/script>')</script>
18+
1519
<!-- Wistia iframe API -->
16-
<script src="//fast.wistia.com/static/iframe-api-v1.js"></script>
20+
<script src="http://fast.wistia.com/static/iframe-api-v1.js"></script>
1721

1822
</head>
1923
<body class="loading">
@@ -126,10 +130,6 @@ <h3>Video</h3>
126130

127131
</div>
128132

129-
<!-- jQuery -->
130-
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
131-
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.min.js">\x3C/script>')</script>
132-
133133
<!-- FlexSlider -->
134134
<script defer src="../jquery.flexslider.js"></script>
135135

jquery.flexslider.js

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,7 @@
44
* Contributing Author: Tyler Smith
55
*/
66
;
7-
(function(factory) {
8-
if (typeof define === 'function' && define.amd) {
9-
// AMD. Register as an anonymous module.
10-
define(['jquery'], factory);
11-
} else {
12-
// Browser globals
13-
factory(jQuery);
14-
}
15-
}(function ($) {
7+
(function ($) {
168

179
//FlexSlider: Object Instance
1810
$.flexslider = function(el, options) {
@@ -22,10 +14,10 @@
2214
slider.vars = $.extend({}, $.flexslider.defaults, options);
2315

2416
var namespace = slider.vars.namespace,
25-
touch = (("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
17+
touch = (( "ontouchstart" in window ) || ( window.navigator.msPointerEnabled ) || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
2618
// depricating this idea, as devices are being released with both of these events
2719
//eventType = (touch) ? "touchend" : "click",
28-
eventType = "click touchend",
20+
eventType = "click touchend MSPointerUp",
2921
watchedEvent = "",
3022
watchedEventClearTimer,
3123
vertical = slider.vars.direction === "vertical",
@@ -137,7 +129,7 @@
137129
if (touch && slider.vars.touch) methods.touch();
138130

139131
// FADE&&SMOOTHHEIGHT || SLIDE:
140-
if (!fade || (fade && slider.vars.smoothHeight)) $(window).bind("resize focus", methods.resize);
132+
if (!fade || (fade && slider.vars.smoothHeight)) $(window).bind("resize orientationchange focus", methods.resize);
141133

142134

143135
// API: start() Callback
@@ -176,13 +168,19 @@
176168
setupPaging: function() {
177169
var type = (slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
178170
j = 1,
179-
item;
171+
item,
172+
slide;
180173

181174
slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>');
182175

183176
if (slider.pagingCount > 1) {
184177
for (var i = 0; i < slider.pagingCount; i++) {
185-
item = (slider.vars.controlNav === "thumbnails") ? '<img src="' + slider.slides.eq(i).attr("data-thumb") + '"/>' : '<a>' + j + '</a>';
178+
slide = slider.slides.eq(i);
179+
item = (slider.vars.controlNav === "thumbnails") ? '<img src="' + slide.attr( 'data-thumb' ) + '"/>' : '<a>' + j + '</a>';
180+
if ( 'thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions ) {
181+
var captn = slide.attr( 'data-thumbcaption' );
182+
if ( '' != captn && undefined != captn ) item += '<span class="' + namespace + 'caption">' + captn + '</span>';
183+
}
186184
slider.controlNavScaffold.append('<li>' + item + '</li>');
187185
j++;
188186
}
@@ -367,7 +365,7 @@
367365
function onTouchStart(e) {
368366
if (slider.animating) {
369367
e.preventDefault();
370-
} else if ( e.touches.length === 1 || ( window.navigator.msPointerEnabled && e.isPrimary ) ) {
368+
} else if ( ( window.navigator.msPointerEnabled ) || e.touches.length === 1 ) {
371369
slider.pause();
372370
// CAROUSEL:
373371
cwidth = (vertical) ? slider.h : slider. w;
@@ -397,25 +395,32 @@
397395
// Cater for Windows-device touch events.
398396
if (window.navigator.msPointerEnabled) {
399397
el.addEventListener('MSPointerMove', onTouchMove, false);
400-
el.addEventListener('MSPointerUp', onTouchEnd, false);
398+
el.addEventListener('MSPointerOut', onTouchEnd, false);
401399
}
402400
}
403401
}
404402

405403
function onTouchMove(e) {
406404
// Local vars for X and Y points.
407-
localX = e.touches[0].pageX;
408-
localY = e.touches[0].pageY;
409405
// Cater for Windows-device touch events.
410-
if (window.navigator.msPointerEnabled) {
406+
if ( window.navigator.msPointerEnabled ) {
411407
localX = e.pageX;
412408
localY = e.pageY;
409+
} else {
410+
localX = e.touches[0].pageX;
411+
localY = e.touches[0].pageY;
413412
}
414413

415414
dx = (vertical) ? startX - localY : startX - localX;
416415
scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY));
417416

418-
if (!scrolling || Number(new Date()) - startT > 500) {
417+
if ( window.navigator.msPointerEnabled ) {
418+
var fxms = 100;
419+
} else {
420+
var fxms = 500;
421+
}
422+
423+
if ( ! scrolling || Number( new Date() ) - startT > fxms ) {
419424
e.preventDefault();
420425
if (!fade && slider.transitions) {
421426
if (!slider.vars.animationLoop) {
@@ -447,7 +452,7 @@
447452
el.removeEventListener('touchend', onTouchEnd, false);
448453
// Cater for Windows-device touch events.
449454
if (window.navigator.msPointerEnabled) {
450-
el.removeEventListener('MSPointerUp', onTouchEnd, false);
455+
el.removeEventListener('MSPointerOut', onTouchEnd, false);
451456
}
452457
startX = null;
453458
startY = null;
@@ -907,17 +912,18 @@
907912
namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin
908913
selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
909914
animation: "fade", //String: Select your animation type, "fade" or "slide"
910-
easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
915+
easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
911916
direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
912917
reverse: false, //{NEW} Boolean: Reverse the animation direction
913-
animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
918+
animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
914919
smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
915920
startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
916921
slideshow: true, //Boolean: Animate slider automatically
917922
slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
918923
animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds
919924
initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds
920925
randomize: false, //Boolean: Randomize slide order
926+
thumbCaptions: false, //Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav.
921927

922928
// Usability features
923929
pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
@@ -994,4 +1000,4 @@
9941000
}
9951001
}
9961002
}
997-
}))(jQuery);
1003+
})(jQuery);

0 commit comments

Comments
 (0)