JSFiddle - React, Tailwind, and code Playground

by Mi_Creativity

HTML

<div id="test"></div>

CSS

#test{
  width:80vw;
  height:80vh;
  margin:0 auto;
  display:block;
  background-image: url('http://lorempixel.com/image_output/business-q-g-1416-1250-10.jpg');
  background-size:contain;
  outline:navy 2px solid;
}

JavaScript

var test = document.getElementById('test');

test.addEventListener('mousedown', function(e){
	if (e.button == 2) {
  	// if right-click, set cursor shape to grabbing
		this.style.cursor = 'move';
  }
});
test.addEventListener('mouseup', function(){
	// set cursor shape to default
	this.style.cursor = 'default';
});
test.oncontextmenu = function(){ 
	//disable context menu on right click
	return false;
}