开发者

Simple Modal - more than one

开发者 https://www.devze.com 2023-02-28 17:10 出处:网络
I\'m using the simplemodal-demo-basic-1.4.1 and iam having trouble using it to open more than one window on a page (I don\'t need them to open at the same time or on top of one another).

I'm using the simplemodal-demo-basic-1.4.1 and iam having trouble using it to open more than one window on a page (I don't need them to open at the same time or on top of one another). I tried adding another class and calling out that class in my js file, but I'm not getting it. I'm sure I'm miss开发者_StackOverflowing something. -Can someone please help?


I'm assuming you're talking about the demo available on the simplemodal Google Code project

Here's what I had to do to add a second modal dialog to that demo:

Add the following HTML to index.html:

  • inside the content div:

    <!-- second modal content -->
    <div id="basicTwo-modal-content">
      <h3>Basic Two Modal Dialog</h3>
      <p>The Second Modal</p>
    </div>
    
  • inside the basic-modal div:

    <input type='button' name='basicTwo' value='Demo Two' class='basicTwo'/> or <a href='#' class='basicTwo'>Demo Two</a>
    

Add the following CSS to basic.css:

    #basicTwo-modal-content { display: none; }

Add the following JavaScript to basic.js inside the jQuery load handler:

    $('#basic-modal .basicTwo').click(function (e) {
      $('#basicTwo-modal-content').modal();

      return false;
    });

Working Demo

0

精彩评论

暂无评论...
验证码 换一张
取 消