Coder Social home page Coder Social logo

pascalreintjens / jquery.modal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from creativedream/jquery.modal

0.0 1.0 0.0 74 KB

A simple jquery Modal boxes, alert, prompt, confirm, themes, buttons, animations, responsive and many other options included.

License: MIT License

CSS 57.53% HTML 19.65% JavaScript 22.83%

jquery.modal's Introduction

jQuery.modal 1.2.3

A simple jQuery Modal plugin.

Demo | Documentation

Usage

Styles:

Include the jquery.modal css file in your html page.

<link href="jquery.modal.css" type="text/css" rel="stylesheet" />

Javascript:

Include the jQuery library and jquery.modal script file in your html page.

<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="jquery.modal.min.js"></script>

The function is called 'modal'. So just call it ;)

modal({
	type: 'inverted', //Type of Modal Box (alert | confirm | prompt | success | warning | error | info | inverted | primary)
	title: 'Message', //Modal Title
	text: 'Text', //Modal HTML Content
	size: 'normal', //Modal Size (normal | large | small)
	buttons: [{
		text: 'OK', //Button Text
		val: 'ok', //Button Value
		eKey: true, //Enter Keypress
		addClass: 'btn-light-blue', //Button Classes (btn-large | btn-small | btn-green | btn-light-green | btn-purple | btn-orange | btn-pink | btn-turquoise | btn-blue | btn-light-blue | btn-light-red | btn-red | btn-yellow | btn-white | btn-black | btn-rounded | btn-circle | btn-square | btn-disabled)
		onClick: function(dialog) {
			console.log(dialog);
			alert('Look in console!');
			return true;
		}
	}, ],
	center: true, //Center Modal Box?
	autoclose: false, //Auto Close Modal Box?
	callback: null, //Callback Function after close Modal (ex: function(result){alert(result); return true;})
	onShow: function(r) {}, //After show Modal function
	closeClick: true, //Close Modal on click near the box
	closable: true, //If Modal is closable
	theme: 'atlant', //Modal Custom Theme (xenon | atlant | reseted)
	animate: false, //Slide animation
	background: 'rgba(0,0,0,0.35)', //Background Color, it can be null
	zIndex: 1050, //z-index
	buttonText: {
		ok: 'OK',
		yes: 'Yes',
		cancel: 'Cancel'
	},
	template: '<div class="modal-box"><div class="modal-inner"><div class="modal-title"><a class="modal-close-btn"></a></div><div class="modal-text"></div><div class="modal-buttons"></div></div></div>',
	_classes: {
		box: '.modal-box',
		boxInner: ".modal-inner",
		title: '.modal-title',
		content: '.modal-text',
		buttons: '.modal-buttons',
		closebtn: '.modal-close-btn'
	}
});

Options

  • type is type of Modal Box, can be : alert | confirm | prompt | success | warning | error | info | primary | inverted.
  • title is title of modal, if is null - title div will disappear
  • text is modal inner HTML content
  • buttons is an array with buttons. Each button is in an object array and contais: text, val, addClass: Class for button(btn-large | btn-small | btn-green | btn-light-green | btn-purple | btn-orange | btn-pink | btn-turquoise | btn-blue | btn-light-blue | btn-light-red | btn-red | btn-yellow | btn-white | btn-black | btn-rounded | btn-circle | btn-square | btn-disabled), onClick(return){} callback('return' contains is an object with keys: bObj - button clicked, bOpts - info abou clicked button from options, val - button value; methods: getContet, getTitle, getModal, setClosable, setContent, setTitle; if function returns false - modal will not disappear)
  • center Center align?, can be true or false
  • autoclose Autoclose Modal?, can be true or false,
  • callback Callback function after modal close, it has a parameter with value and if function returns false, modal will not disappear
  • onShow After modal appearing, it has a parameter with modal object
  • closeClick On click near the modal box, close it
  • closable Enable Modal closing
  • animate Enable slide Animation
  • theme Custom class for your modal (default | xenon | atlant | reseted)
  • background Background Color of modal overlay
  • zIndex Modal z-index
  • buttonText Custom text for alert, confirm and prompt modals
  • template Custom modal template
  • _classes An object with each class name from modal box

License

Licensed under MIT license.

jquery.modal's People

Contributors

creativedream avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.