Hi, I'm Ray

I'm a software developer, full-time nerd and occasional human (while heavily caffeinated).

BSDialog

BSDialog is a JavaScript helper for improving Bootstrap 3 modals.
Add (and remove) modals to a page dynamically and load content with jQuery/AJAX.

Bootstrap 3 is required.

Download Source Repository

Features

  • Add (inject) and remove modals into a page
  • Load modal-content or modal-body from URL with jQuery-AJAX
  • Stack multiple modals
  • Drag and move the modals

Change Log

  • 09/11/2019
        – Release: v0.1.0.029a
        – Added cross-domain support
  • 24/09/2019
        – Release: v0.1.0.029
        – Added argument to disable resizing
  • 19/09/2019
        – Release: v0.1.0.027
        – Added support for drag and move dialog
  • 22/08/2019
        – Release: v0.1.0.026
        – Added button to toggle Modal size (medium and large)
  • 27/07/2019
        – Release: v0.1.0.025
        – Added support for null URL
  • 07/07/2019
        – Release: v0.1.0.024
        – Major rewrite
        – Added support for modal-content and modal-body content update
  • 14/07/2015
        – Release: v0.1.0.023

Usage

  • Create(id, title, url, [is_big], [update_body])

    id string Unique identifier for the modal, so you can refer to multiple modal
    title string Label at the top of the modal
    url string URL to load into the modal body
    is_big boolean Use large width or medium width on the modal. (Optional. Default is false)
    update_body boolean Update modal-body with content, otherwise model-content. (Optional. Default is true)
    show_resize boolean Show resize button. (Optional. Default is true)

    Creates the Modal on the page and loads the body from a URL. An existing box will be reused if the ID already exists.


    BSDialog.Create("123", "My Modal Box 123", null);
    BSDialog.Create("123", "My Modal Box 123", "/my-modal-box.html");
    BSDialog.Create("123", "My Modal Box 123", "/my-modal-box.html", false);
    BSDialog.Create("123", "My Modal Box 123", "/my-modal-box.html", false, false);
    BSDialog.Create("123", "My Modal Box 123", "/my-modal-box.html", false, true, false);

    Run Example 1 Run Example 2 Run Example 3 Run Example 4 Run Example 5

     

  • Close(id)

    id string Unique identifier for the modal, so you can refer to multiple modal

    Close the Modal box by the box identifier.

    BSDialog.Close("123");

     

  • Clear()

    Close all Modal boxes on the page.

    BSDialog.Clear();

     

  • ShowToast(id, title, message, [is_big])

    id string Unique identifier for the modal, so you can refer to multiple modal
    title string Label at the top of the modal
    message string Message text
    is_big boolean Use large width or medium width on the modal. (Optional. Default is false)

    Creates the Modal on the page and loads a message.


    BSDialog.ShowToast("123", "My Modal Box 123", "Hello World");
    BSDialog.ShowToast("123", "My Modal Box 123", "Hello World", true);

    Run Example 1 Run Example 2

     

  • Exists(id)

    id string Unique identifier for the modal

    Return true or false, if Modal exists.

     

Acknowledgements

This software uses a number of dependencies and assets from third-parties. These developers and artists deserve due credit for their work and for their commitment to sharing their work freely. Each product is released under their own particular license, for more information please visit their websites.

Copyright © 2014-2019 Ray Lam. All Rights Reserved.