Skip to content

Instantly share code, notes, and snippets.

@aka-z
Forked from MrDys/gist:3512455
Created October 30, 2019 11:04
Show Gist options
  • Save aka-z/e9b7b89762de61f790ef06e8b71964ae to your computer and use it in GitHub Desktop.
Save aka-z/e9b7b89762de61f790ef06e8b71964ae to your computer and use it in GitHub Desktop.

Revisions

  1. @MrDys MrDys revised this gist Aug 29, 2012. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,11 @@
    If you've ever had the need to link directly to an open modal window with Bootstrap, here's a quick and easy way to do it:
    /* If you've ever had the need to link directly to an open modal window with Bootstrap, here's a quick and easy way to do it:
    Make sure your modal has an id:
    <div class="modal" id="myModal" ... >
    Then stick this bit of Javascript at at the end of your document:
    */

    $(document).ready(function() {

    @@ -14,4 +15,6 @@ $(document).ready(function() {

    });

    Then you can send people to http://www.website.com/page.html#myModal and it'll load the page with the modal open.
    /*
    Then you can send people to http://www.website.com/page.html#myModal and it'll load the page with the modal open.
    */
  2. @MrDys MrDys created this gist Aug 29, 2012.
    17 changes: 17 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    If you've ever had the need to link directly to an open modal window with Bootstrap, here's a quick and easy way to do it:

    Make sure your modal has an id:

    <div class="modal" id="myModal" ... >

    Then stick this bit of Javascript at at the end of your document:

    $(document).ready(function() {

    if(window.location.href.indexOf('#myModal') != -1) {
    $('#myModal').modal('show');
    }

    });

    Then you can send people to http://www.website.com/page.html#myModal and it'll load the page with the modal open.