• Stars
    star
    1,764
  • Rank 25,271 (Top 0.6 %)
  • Language
    JavaScript
  • Created over 11 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Avgrund is jQuery plugin with new modal concept for popups

Avgrund

Libscore Badge

Avgrund is a jQuery plugin for your modal boxes and popups. It uses new concept showing depth between popup and page.

It works in all modern browsers and gracefully degrade in those that do not support CSS transitions and transformations.

Tested with jQuery versions 1.4+

File size of minified version is ~1Kb.

Usage

You can simply include javascript file and init Avgrund with one line:

$('element').avgrund();

and linking avgrund.css file to the project:

<link rel="stylesheet" href="path/to/your/avgrund.css">

If you use bower then you can simply install it as:

bower install jquery.avgrund

Using plugin with Browserify

At first install plugin via NPM:

npm install jquery.avgrund
npm install jquery-browserify

In your server-side node.js (e.g. express app):

app.use(require('browserify')({
    require : ['jquery-browserify', 'jquery.avgrund']
}));

And in your browser-side you can init plugin now:

var $ = require('jquery-browserify');
require('jquery.avgrund')($);

Options

You're also able to use some of the options that let you customize it as you wish:

$('element').avgrund({
    width: 380, // max is 640px
    height: 280, // max is 350px
    showClose: false, // switch to 'true' for enabling close button
    showCloseText: '', // type your text for close button
    closeByEscape: true, // enables closing popup by 'Esc'..
    closeByDocument: true, // ..and by clicking document itself
    holderClass: '', // lets you name custom class for popin holder..
    overlayClass: '', // ..and overlay block
    enableStackAnimation: false, // enables different type of popin's animation
    onBlurContainer: '', // enables blur filter for specified block
    openOnEvent: true, // set to 'false' to init on load
    setEvent: 'click', // use your event like 'mouseover', 'touchmove', etc.
    onLoad: function (elem) { ... }, // set custom call before popin is inited..
    onUnload: function (elem) { ... }, // ..and after it was closed
    template: 'Your string content goes here..' // or function (elem) { ... }, or selector $('.content')
});

More detailed information on every option you can find here.

Documentation

Here is the list of available avgrund options:

width - string | number, default: '380px'

Set popup width (currently stict to max 640px).

height - string | number, default: '280px'

Set popup height (currently strict to max 350px).

showClose - boolean, default: false

Show/hide close button.

showCloseText - string

If you decided to show close button then you probably want to add close text to it.

closeByEscape - boolean, default: true

Allow users to close popup by clicking Esc button.

closeByDocument - boolean, default: true

Allow users to close popup by clicking everywhere on document (except popup of course).

holderClass - string

Adds custom css classes to avgrund popup, example:

$(element).avgrund({
    holderClass: 'my-custom-class'
});

results in adding this class to avgrund container:

<div class="avgrund-popin my-custom-class">...</div>
overlayClass - string

Adds custom css classes to avgrund overlay container.

enableStackAnimation - boolean, default: false

Possibility to add a bit different popup hiding animation type.

onBlurContainer - string

Class name for container element that will be blurred when popup appears, example:

$(element).avgrund({
    onBlurContainer: '#my-container'
});

Please note that currently css blur is not supported in all modern browsers.

openOnEvent - boolean, default: true

If you want to show avgrund on page load set this option value to false, example:

$(document).avgrund({
    openOnEvent: false
});
setEvent - string, default: 'click'

With this option you can manage events that will open popup on certain element:

$(element).avgrund({
    setEvent: 'mouseover' // will open popin on element's mouseover
});
onLoad - function

If you need to make some preparations or whatever before avgrund popup will be shown, example:

$(element).avgrund({
    onLoad: function (element) {
        console.log('This function will be called before dialog is initialized');
    }
});
onUnload - function

This function will be executed after popup was closed, example:

$(element).avgrund({
    onUnload: function (element) {
        console.log('This message will be shown after dialog is closed');
    }
});
template - string | function | jQuery object

Specify your content for popin here, it can be string value:

$(element).avgrund({
    template: '<p>This is popin content!</p>'
});

or function that returns content itself:

$(element).avgrund({
    template: function (element) {
        // return 'your content..'
    }
});

Also it accepts jQuery objects (dynamic as well), so you can create element with content inside your app:

<div class="content" style="display: none;">
    My content for popin!
</div>

and use it in template of popin:

$('element').avgrund({
    template: $('.content')
});

Demo

Check the example here: http://labs.voronianski.dev/jquery.avgrund.js/

Inspired by Hakim's demo: https://github.com/hakimel/avgrund/

Changelog

Update (Sep 28, 2013)

Added AMD and CommonJS styles support.

Update (Sep 22, 2013)

Added support jQuery selectors in template option.

Update (June 15, 2013)

Better fix for overlay and long content pages, minor add-ons.

Update (May 26, 2013)

Few fixes, and plugin is available as bower package now. So you can simply install it as:

Update (Feb 25, 2013)

A bunch of small but very useful fixes and updates, including multiple avgrund popins on a page, removing popins from DOM after deactivation (also fixed an issue to make sure avgrund close effect works) and position:fixed/transform/overflow issue for scrolled pages in -webkit.

Update (Nov 18, 2012)

Get 2 new useful options for popin that were missed before. Now you can set your custom functions before Avgrund dialog is open and after it was closed.

Update (Sep 30, 2012)

Some new updates include initializing popin without event. Also now you can set up your own event for an element. Added ability to use a custom function inside avgrund's template option. Thanks to juice49 for pull request.

Update (Aug 31, 2012)

New options added - disable closing popup by 'Esc' and 'Document click'. Blur css filter for browsers that support it (seems only webkit ones for now).

Contribution

We still have some issues to fix and make avgrund better, if you have any suggestions raise them in issues please.


MIT Licensed

enjoy!

Bitdeli Badge

More Repositories

1

flux-comparison

📝 Practical comparison of different Flux solutions
JavaScript
2,785
star
2

oceanic-next-color-scheme

📐 Sublime Text color scheme ready for next generation JavaScript syntax
JavaScript
1,972
star
3

react-swipe

↔️ Swipe.js as a React component
JavaScript
1,662
star
4

ngActivityIndicator

Angular provider for preloader animations
CSS
644
star
5

esnextbin

🍱 Prototype apps in the browser with next generation JavaScript and NPM modules
JavaScript
463
star
6

ngprogress-lite

Angular provider for slim progress bars
HTML
394
star
7

react-native-effects-view

Use iOS8 UIVisualEffectViews's blur and vibrancy with ReactNative
Objective-C
387
star
8

react-star-rating-component

Basic React component for star (or any other icon based) rating elements
JavaScript
378
star
9

realtime-geolocation-demo

Realtime geolocation with HTML5 API and Socket.io
JavaScript
337
star
10

melchior.js

Chainable Module Definition (CMD) dependency loader for JavaScript
JavaScript
305
star
11

soundcloud-audio.js

🎵 SoundCloud tracks and playlists with HTML5 Audio API
JavaScript
285
star
12

swipe-js-iso

Universal (a.k.a isomorphic) version of Swipe.js
JavaScript
189
star
13

universal-react-flux-boilerplate

React (0.13.x) + Flux (Flummox) + ReactRouter (0.13.x) + Server Rendering
JavaScript
170
star
14

simon-le-bottle

Getting started with Facebook Messaging Platform
JavaScript
111
star
15

dookie-css

stylus driven css library
CSS
109
star
16

node-tweet-cli

Start making tweets from your bash, zsh, whatever!
JavaScript
83
star
17

xml2obj-stream

XML to JavaScript object low memory streaming parser based on node-expat
JavaScript
63
star
18

griddy.css

📖 Responsive 12 column based grid in 311 Bytes gzipped
HTML
63
star
19

ngKookies

Powerful replacer for built-in Angular's $cookieStore (https://github.com/angular/angular.js/issues/950)
JavaScript
60
star
20

is-express-schema-valid

🏁 express.js middleware that validates body, params, query of request according to JSONSchema and is extremely fast
JavaScript
59
star
21

node-object-encrypter

Encrypt/decrypt javascript objects as base64 strings with optional TTL support
JavaScript
58
star
22

express-api-sample

Sample API ready to be used in different client app boilerplates and playgrounds.
JavaScript
48
star
23

babel-transform-in-browser

Transform ES2015 in browser on the fly with Babel.js
JavaScript
45
star
24

node-tiny-dploy

Simple shell script + PM2 deployer
JavaScript
42
star
25

dumbugger

Automatically google for similar JavaScript errors when thrown.
HTML
38
star
26

node-grvtr

grvtr.js - small node.js gravatar library
JavaScript
32
star
27

node-config-boilerplate

Easy configs for node.js apps
JavaScript
28
star
28

react-pikaday-component

Universal React component wrapper around Pikaday.js datepicker
JavaScript
19
star
29

psi-local-cli

Google PageSpeed Insights CLI for localhost (via ngrok)
JavaScript
18
star
30

data-structures-and-algorithms-in-javascript

Basic data structures and algorithms implemented in JavaScript
JavaScript
16
star
31

Do-I-Know-JS

Javascript patterns uncovered with examples
JavaScript
13
star
32

setup-osx-work-station

🎁 OS X machine setup shell script
Shell
11
star
33

is-my-schema-valid

Simple function that validates data according to JSONSchema
JavaScript
9
star
34

versionify-assets

Function to get checksum of file and add to url querystring for cache busting
JavaScript
7
star
35

vapor-favicon-middleware

Favicon serving middleware for Vapor applications.
Swift
6
star
36

react-router-hooks-patch

Patch react-router route handler components with static hook methods onEnter/onLeave
JavaScript
6
star
37

uneasy-flux-demo

Practical flux to manage uneasy API scenarios like handling errors or pending requests
JavaScript
5
star
38

create-static

Create static html pages with esnext, scss and nunjucks easily.
JavaScript
5
star
39

c0nfig

Require local configs as if they are in node_modules
JavaScript
5
star
40

EightTracksSwift

8tracks radio client for iOS8 implemented in Swift
Swift
5
star
41

EightTracksReactNative

8tracks radio client for iOS powered by ReactNative
JavaScript
4
star
42

update-to-latest

Simple cli tool for easy update of npm dependencies.
JavaScript
3
star
43

waveform.js

Waveform.js makes drawing SoundCloud waveforms simple
JavaScript
3
star
44

node-shufflerfm

Shuffler.fm API client for Node.js
JavaScript
3
star
45

discogs-wantlist-cli

📀 Extract releases from Discogs user wantlist without duplicates.
JavaScript
2
star
46

vapor-server-example

Examples of server-side Swift powered by Vapor.
Swift
2
star
47

go2url.xyz

🌍 Change window.location in a second
HTML
2
star
48

swapi-graphql-react-app

SPA that allows to 🔎 search for all human characters in 🌠 Star Wars saga.
JavaScript
2
star
49

react-waves

Top sounds of the web built with React components
JavaScript
2
star
50

isomorphic-flux-comparison

2
star
51

react-ace-preact-compat-issue

JavaScript
2
star
52

vapor-checksum-assets

Add checksums of .js/.css files to url querystring in Vapor applications for cache busting.
Swift
2
star
53

telepath-mini

Tiny and smart music player for OS X
CSS
2
star
54

melchior-landing

CSS
2
star
55

multi-translator

Get transations from several dictionaries in one app.
JavaScript
2
star
56

luvit-static-server-demo

Static server demo based on luvit.io
Lua
2
star
57

next-13-ninetailed-middleware-issue

TypeScript
1
star
58

soundcloud-api-proxy

🎶 Just a simple proxy server for not letting to abuse my SoundCloud client secrets.
JavaScript
1
star
59

vue2-examples

Playing with Vue 2.0 beta
JavaScript
1
star
60

izzit-mac-client

1
star
61

nooop

Just a noop function
JavaScript
1
star
62

fluid-layout-with-boxes

Small cross-browser hack in pure JS
JavaScript
1
star
63

universal-react-router-flux-2016

Opionated example of universal app setup
JavaScript
1
star
64

latest-browsers-api

JSON API to get the latest browser versions.
JavaScript
1
star
65

monqo-query-cli

make mongo shell queries from bash
JavaScript
1
star
66

contrabass.css

CSS utility belt in 1.99 kB
CSS
1
star
67

demo-tracker-app

demo of time tracker app written in angular
JavaScript
1
star
68

hamlet-boilerplate

App template for getting started with Hamlet
JavaScript
1
star
69

hash-unhash-exercise

JavaScript
1
star
70

angular_tuts

JavaScript
1
star
71

vapor-url-shortener

Basic url shortener API implemented in Swift and Vapor
1
star
72

webpack-trouble-demo

Webpack-dev-server + Existing node.js server = Some troubles
JavaScript
1
star