Skip to content

Commit

Permalink
Merge pull request #73 from supertorio/master
Browse files Browse the repository at this point in the history
Drag start/stop Callbacks & Playback Direction
  • Loading branch information
creativeaura committed Mar 23, 2016
2 parents 8fa8741 + c138a72 commit 81ed02f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/threesixty.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 17 additions & 2 deletions src/threesixty.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,11 @@
* You are start the auto rotaion for the slider with this function.
*
*/
base.play = function(speed) {
base.play = function(speed, direction) {
var _speed = speed || AppConfig.playSpeed;
var _direction = direction || AppConfig.autoplayDirection;
AppConfig.autoplayDirection = _direction

if (!AppConfig.autoplay) {
AppConfig.autoplay = true;
AppConfig.play = setInterval(base.moveToNextFrame, _speed);
Expand Down Expand Up @@ -412,16 +415,18 @@
if ((event.type === 'mousedown' && event.which === 1) || event.type === 'touchstart') {
AppConfig.pointerStartPosX = base.getPointerEvent(event).pageX;
AppConfig.dragging = true;
AppConfig.onDragStart(AppConfig.currentFrame);
} else if (event.type === 'touchmove') {
base.trackPointer(event);
} else if (event.type === 'touchend') {
AppConfig.dragging = false;
AppConfig.onDragStop(AppConfig.endFrame);
}
});

$(document).bind('mouseup', function (event) {
//event.preventDefault();
AppConfig.dragging = false;
AppConfig.onDragStop(AppConfig.endFrame);
$(this).css('cursor', 'none');
});

Expand Down Expand Up @@ -836,6 +841,16 @@
* Callback triggers once all images are loaded and ready to render on the screen
*/
onReady: function() {},
/**
* @cfg {Function} onDragStart
* Callback triggers when a user initiates dragging
*/
onDragStart: function() {},
/**
* @cfg {Function} onDragStop
* Callback triggers when a user releases after dragging
*/
onDragStop: function() {},
/**
* @cfg {String} imgList
* Set ul element where image will be loaded
Expand Down

0 comments on commit 81ed02f

Please sign in to comment.