Skip to content

Latest commit

 

History

History
187 lines (168 loc) · 3.91 KB

CONTRIBUTIONS.md

File metadata and controls

187 lines (168 loc) · 3.91 KB

Contributions

  • please every pull request must be added to this file with sample usage
  • to see how to structure usage, please check wiki page of this project or scroll down to see example

Don't know how to start?

  • fork this repository
  • clone your fork into localhost
git clone https://github.com/{your_name}/over.js.git
  • create your branch
git checkout -b name-of-branch
  • make changes
  • commit and push
git add .
git commit -m 'message with changes'
git push origin name-of-branch
  • create a pull request from forked repository
  • wait until approval

Example of contribution:

onClick

  • github
  • call custom function when clicked on target element
document.querySelector('.test').over({
	onClick: function(self, event) {
		.....
	}
})
  • function, default value: function() {}

Approved contributions

onContextMenu || onRightClick

  • github
  • call custom function when right clicking on target element
document.querySelector('.test').over({
	onRightClick: function(self, event) {
		.....
	}
})
  • function, default value: function() {}

contextMenuPreventDefault || rightClickPreventDefault

  • github
  • addition to onContextMenu action, enabling or disabling default action on right click
document.querySelector('.test').over({
    rightClickPreventDefault: false
})
  • boolean, default value: false

onClick

  • github
  • event which execute callback when user clicks target
document.querySelector('.test').over({
    onClick: function(self, event) {
		console.log("Clicked!");
	}
})
  • function, default value: function() {}

onMouseDown

  • github
  • event which execute callback when user start holding left button
document.querySelector('.test').over({
    onMouseDown: function(self, event) {
		console.log("User started holding left button!");
	}
})
  • function, default value: function() {}

onMouseUp

  • github
  • event which execute callback when user release left button
document.querySelector('.test').over({
    onMouseUp: function(self, event) {
		console.log("User released left button!");
	}
})
  • function, default value: function() {}

onRightClickDown

  • github
  • event which execute callback when user start holding right button
document.querySelector('.test').over({
    onRightClickDown: function(self, event) {
		console.log("User started holding right button!");
	}
})
  • function, default value: function() {}

onRightClickUp

  • github
  • event which execute callback when user release right button
document.querySelector('.test').over({
    onRightClickUp: function(self, event) {
		console.log("User released right button!");
	}
})
  • function, default value: function() {}

onDrag

  • github
  • event which execute callback when user move with mouse while holding left button
document.querySelector('.test').over({
    onDrag: function(info, self, event) {
		//info:
		/*
			{
				position: {
					x: e.pageX,
					y: e.pageY
				},
				difference: {
					x: e.movementX,
					y: e.movementY
				},
				relativePosition: {
					x: e.layerX,
					y: e.layerY
				}
			}
		*/
	}
})
  • function, default value: function() {}

onRightDrag

  • github
  • event which execute callback when user move with mouse while holding right button
document.querySelector('.test').over({
    onRightDrag: function(info, self, event) {
		//info:
		/*
			{
				position: {
					x: e.pageX,
					y: e.pageY
				},
				difference: {
					x: e.movementX,
					y: e.movementY
				},
				relativePosition: {
					x: e.layerX,
					y: e.layerY
				}
			}
		*/
	}
})
  • function, default value: function() {}