Git Product home page Git Product logo

dialogable.js's Introduction

Dialogables [WIP]

This provides super-duper easy ajaxy dialog behaviour to your apps.

Why did I do this, you ask? Well, all "dialogs" / "modals" are annoying and based off an already existing DOM element. This is all good and dandy for simple stuff, but when your app is ready to be uber cool, you may want to utilize dialogs given a link or a button (or whatever your heart desires). Maybe you want to have many dialogs on a page or a dialog that will pop-up another dialog.... Well, this plugin makes your life easier. You're welcome :)

Features

  • Loads remote dialogs.
  • Inspired by Twitter Bootstrap modals.
  • No need to create empty dialog divs and bloat your markup... this does the work for you. =)
  • Supports multiple dialogs.
  • ... extremely simple.

The Magic

<!-- using data-api (preferred way!) -->
<a data-toggle="dialog" href="/example/remote.html">Dialog Link</a>

or

<!-- initializing by selector -->
<a class="dialogable" href="/example/remote.html">Dialog Button</a>
<script>
    $(function() {
        $('a.dialogable').dialogable();
    });
</script>

Some Events

// show event - before loading remote content
$(document).on('show', 'a.dialogable, [data-toggle="dialog"]', function(e) {
    // ... stuffs go here!
});

// shown event - after dialog has been loaded
$(document).on('shown', 'a.dialogable, [data-toggle="dialog"]', function(e) {
    // ... stuffs go here!
});

// destroy event - before dialog is actually destroyed
$(document).on('destroy', 'a.dialogable, [data-toggle="dialog"]', function(e) {
    // ... stuffs go here!
});

// destroyed event - after dialog has been destroyed
$(document).on('destroyed', 'a.dialogable, [data-toggle="dialog"]', function(e) {
    // ... stuffs go here!
});

Extra Stuffs

Options:

$('a.dialogable').dialogable({
    prototype: $('<div />', { class: 'dialog' }).hide(), // pass in a different prototype if you want =)!
});

Examples

See example/index.html for more magical stuffs.

dialogable.js's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

tzkmx

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.