Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag start/stop Callbacks & Playback Direction #73

Merged
merged 2 commits into from Mar 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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