Skip to content
This repository has been archived by the owner on May 10, 2018. It is now read-only.

Defect. Disappear all carousel elements. #399

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/directives/rn-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,26 @@
rubberTreshold = 3;

var requestAnimationFrame = $window.requestAnimationFrame || $window.webkitRequestAnimationFrame || $window.mozRequestAnimationFrame;

var debounce = function(func, wait, immediate) {
var timeout;
return function() {
var context = this,
args = arguments;
var later = function() {
timeout = null;
if ( !immediate ) {
func.apply(context, args);
}
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait || 300);
if ( callNow ) {
func.apply(context, args);
}
};
};

function getItemIndex(collection, target, defaultIndex) {
var result = defaultIndex;
Expand Down Expand Up @@ -577,10 +597,10 @@
}
}

function onOrientationChange() {
var onOrientationChange = debounce(function() {
updateContainerWidth();
goToSlide();
}
});

// handle orientation change
var winEl = angular.element($window);
Expand Down