Skip to content

agrothe/moveevents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Move Events

Javascript Up/Down/Right/Left move events

Example Usage:

var m = moveEvents({
  element: document.getElementById('mydiv'),
  swipeLeft: function(e){console.log('swipeLeft');},
  swipeRight: function(e){console.log('swipeRight');},
  swipeDown: function(e){console.log('swipeDown');},
  swipeUp: function(e){console.log('swipeUp');}
});

Each swipe event provides access to the original element.

swipeDown: function(e){ MoveDown(e); },
function MoveDown(element){
	var top = parseInt(element.style.top.replace('px',''));
	top += 10;
	element.setAttribute('style', 'top:' + top + 'px');
}

Play with the code at jsbin: http://jsbin.com/AGoGEpaK/4/edit

About

Javascript Up/Down/Right/Left move events

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published