Magento 2 offers very easy way to use popup or sliding panels.

It can be achieved with the following piece of jQuery code anywhere you want (blocks, pages, templates, …).

<script type="text/javascript">
	require(
		[
			'jquery',
			'Magento_Ui/js/modal/modal'
		],
		function($, modal){
			var options = {
				type: 'popup', // there is also a slide type. By default sliding from the right.
				responsive: true,
				innerScroll: true,
				buttons: [{
					text: $.mage.__('Close'),
					class: '',
					click: function () {
						this.closeModal();
					}
				}]
			};

			var popup = modal(options, $('#popup-modal'));
			
			//Popup appears on click on specific emelent with id=click-me			
			$("#click-me").on('click',function(){ 
				$("#popup-modal").modal("openModal");
			});
			
			//Popup appears on winodow load
			$('#popup-modal').modal('openModal');
		}
	);
</script>

Also, you will need some html.

<!-- Link which will trigger popup on click. -->
<a href="#" id="click-me">Click me</a>

<!-- Popup content. -->
<div id="popup-modal">Here goes content modal</div>

As you can it is very easy to handle events (click, on window load, hover, …).

There are 2 types of modals in magento – Popup and Sliding Panel.

More about modal options you can find in official Magento documentation.