Skip to content

Vanilla JavaScript Google's MaterialDesign-like modal window

Notifications You must be signed in to change notification settings

fechanique/material-modal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

material-modal

Vanilla JavaScript Google's MaterialDesign-like modal window

Installation

<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/fechanique/material-modal/master/material-modal.css">
<script src="https://cdn.rawgit.com/fechanique/material-modal/master/material-modal.js"></script>

Functions

Open alert

//Opens a modal window with OK button
//materialAlert(title, text, callback)

materialAlert('Title', 'Content', function(result){
	if(result==true) console.log('OK button pressed');
	else console.log('No button was pressed');
});

Open confirm

//Opens a modal window with OK and CANCEL button
//materialConfirm(title, text, callback)

materialConfirm('Title', 'Content', function(result){
	if(result==true) console.log('OK button pressed');
	else console.log('CANCEL button was pressed or no button was pressed');
});

Example

<html>
	<head>
		<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
		<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/fechanique/material-modal/master/material-modal.css">
		<script src="https://cdn.rawgit.com/fechanique/material-modal/master/material-modal.js"></script>
	</head>
	<body>
		<button onclick="materialConfirm('Title','Content',function(result){console.log(result)})">Show confirm</button>
		<button onclick="materialAlert('Title','Content',function(result){console.log(result)})">Show alert</button>
	</body>
</html>

About

Vanilla JavaScript Google's MaterialDesign-like modal window

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published