Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8787597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:55:50+00:00 2026-06-13T21:55:50+00:00

I managed to get multiple modal windows working using the simplemodal plugin, but I

  • 0

I managed to get multiple modal windows working using the simplemodal plugin, but I need to be able to switch between them without having the user manually close it first.

At this point I’m still learning this by example. I have seen a couple other references to this problem, but the offered solutions either don’t work or don’t start with the same building blocks.

Any tips or advice greatly appreciated.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SimpleModal</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type='text/javascript' src='js/jquery.simplemodal.js'></script>
<script>
jQuery(function ($) {
    $('#basic-modal .link1').click(function (e) {
        $('#link1-modal-content').modal();
        return false;
    });

    $('#basic-modal .link2').click(function (e) {
        $('#link2-modal-content').modal();
        return false;
    });

    $('#basic-modal .link3').click(function (e) {
        $('#link3-modal-content').modal();
        return false;
    });
});
</script>
<style>
#simplemodal-overlay {background-color:#000; cursor:wait;}
</style>
</head>

<body>

<!-- MAIN PAGE / LINKS TO MODAL WINDOWS-->
<div id='basic-modal'>
    <a href="#" class="link1" id="pop1">Link to Content 1</a><br />
    <a href="#" class="link2" id="pop2">Link to Content 2</a><br />
    <a href="#" class="link3" id="pop3">Link to Content 3</a><br />
</div>



<!-- INDIVIDUAL MODAL WINDOWS CONTENT  -->
<div id="link1-modal-content" style="display:none; width:200px; height:200px; background-color:#FFFFFF;">
    <p>Content 1</p>
    Content 1<br />
    <a href="#" class="link2" id="pop2">Link to Content 2</a><br />
    <a href="#" class="link3" id="pop3">Link to Content 3</a><br />
</div>

<div id="link2-modal-content" style="display:none; width:200px; height:200px; background-color:#FFFFFF;">
    <p>Content 2</p>
    <a href="#" class="link1" id="pop1">Link to Content 1</a><br />
    Content 2<br />
    <a href="#" class="link3" id="pop3">Link to Content 3</a><br />
</div>

<div id="link3-modal-content" style="display:none; width:200px; height:200px; background-color:#FFFFFF;">
    <p>Content 3</p>
    <a href="#" class="link1" id="pop1">Link to Content 1</a><br />
    <a href="#" class="link2" id="pop2">Link to Content 2</a><br />
    Content 3<br />
</div>


</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:55:51+00:00Added an answer on June 13, 2026 at 9:55 pm

    SimpleModal only allows for one modal to be open at any point, as such you need to close any existing modal and open a new one or swap their content.

    To open/close use the following in place of your javascript :

    function closeAllModal() {
        $.modal.close();
    }
    
    jQuery(function ($) {
    
    
        $('.link1').click(function (e) {
            closeAllModal();
    
            $('#link1-modal-content').modal();
            return false;
        });
    
    
        $('.link2').click(function (e) {
            closeAllModal();
    
            $('#link2-modal-content').modal();
            return false;
        });
    
        $('.link3').click(function (e) {
            closeAllModal();
            $('#link3-modal-content').modal();
    
            return false;
        });
    });
    

    I have altered the click selector to be generic so it binds to all the links and added a call to close the modals before opening in each. This should give you the desired effect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've managed to get multiple filters working using the jQuery Masonry plugin, the only
I managed to get the YUI calendar widget working fine. But When it displays
I managed to get custom themes running for Tabs but still got a lil
I've managed to get a PNG overlay to appear over an asp:hyperlink image, but
I'm trying to get multiple clients to connect to a server. What I've managed
I have managed to get code the knockoutJS jqauto auto-complete working as per the
I am creating multiple persistent store in my application, but I am using only
I've searched a bit before asking this but I definitely can't get it working...
I don't get the point of having multiple Managed Object Contexts. Does that make
So, I managed to get NSTask to read asynchronously from a program, but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.