Coder Social home page Coder Social logo

popuper's Introduction

#jquery.popuper

Extremely lightweight jquery plugin script to show popup blocks. No fancy effects and redundant gimmicks, full control over the process instead.

##Usage

Get the jquery.popuper.js. Add to page:

<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.popuper.js" type="text/javascript"></script>

###Possible options

/**
 * @param {Object} hParam Options:
 * @option {String} hiddenClass CSS class name for block hiding, 'g-hidden' by default.
 * @option {String} animatedClass CSS class name for animation purposes (see the example).
 * @option {Number} hideDelay Delay between `hiddenClass` and `animatedClass` assignation, defaults to 0.
 * @option {String|Element|jQuery} fader Fader block (selector, DOM-element or jQuery), optional.
 * @option {String|Element|Array[Element]|jQuery} open Popup runner block or link.
 * @option {String|Element|Array[Element]|jQuery} close Inner Popup close element, will be searched inside main element.
 * @option {Function} onShow Callback, being called upon show event.
 * @option {Function} onHide Callback, being called upon hide event.
 */

Use page fader to make block it "modal".

###Example

$(function () {
	var container = $('.popup-container');
	container.popuper({
		hiddenClass: 'g-hidden',
		fader: '.page-fader',
		open: 'span.show-popup',
		close: container.find('.icon-close'),
		onShow: function () {
			// do some useful stuff here,
			// positioning for example
		},
		onHide: function () {
			// do some unuseful stuff here
		}
	});
});
.g-hidden {
	display: none;
}

.page-fader {
	position: fixed;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background: #000;
	opacity: 0.35;
	z-index: 1000;
	filter: alpha(opacity=35);
}

.popup-container {
	position: fixed;
	left: 50%;
	top: 33%;
	width: 24em;
	margin-left: -12em;
	z-index: 1001;
}

###Example with CSS animations It's here.

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.