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 8446857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:01:57+00:00 2026-06-10T10:01:57+00:00

I have a basic overlay setup using css/html/jquery and it goes like this: <a

  • 0

I have a basic overlay setup using css/html/jquery and it goes like this:

<a class="activator" id="activator" style="" href="#">hello</a>

<div class="overlay" id="overlay" style="display:none;"></div>
<div style="display: none;" class="box" id="box">
     <a class="boxclose" id="boxclose">X</a>
      <iframe src="http://url" style="position: absolute; top: 0px; right: 0px; left: 0px; bottom: 0px;"></iframe>
</div>

     <script type="text/javascript" src="http://goo.gl/LKdBi"></script>
     <script type="text/javascript">
        $(function() {
            $('#activator').click(function(){
                $('#overlay').fadeIn('fast',function(){
                    $('#box').show('fast');
                });
            });


            $('#boxclose').click(function(){
                $('#box').hide('fast',function(){
                    $('#overlay').fadeOut('fast');
                });
            });

        });
    </script>

This allows the link clicked, to open up a simple overlay that can be closed by clicking the X.

My question is, I’d like to have multiple links to click on that either open up their own overlay or use the same one (I’d think using the same iframe is doable). Is there a more simple method for what I’m attempting? I haven’t been able to figure it out short of making separate calls for each different link I have.

edit:

Ideally, I would have 5 or so links, each of them when clicked, opens the overlay and displays the url it’s pointing at. the overlay can then be closed by clicking away on the background or the ‘X’.

Thanks

  • 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-10T10:01:59+00:00Added an answer on June 10, 2026 at 10:01 am

    You are looking for the closest() and next() functions. Also, since you will have multiple links, you will need to use classes instead. Something along these lines should work for you:

    $(function() {
        $('.activator').click(function(){
            $(this).next('.overlay').fadeIn('fast', function(){
                $(this).next('.box').show('fast');
            });
        });
    
    
        $('.boxclose').click(function(){
            $(this).closest('.box').hide('fast',function(){
                $(this).closest('.overlay').fadeOut('fast');
            });
        });
    });
    

    Since you are only wanting one iframe and overlay. Here is a simplified version that should work for you:

    HTML:

    <a class="activator" href="http://www.google.com/">hello</a>
    <a class="activator" href="http://www.bing.com/">hello</a>
    
    <div class="overlay" style="display:none;"></div>
    <div class="box" style="display: none;">
        <a class="boxclose">X</a>
        <iframe class="frame" style="position: absolute; top: 0px; right: 0px; left: 0px; bottom: 0px;> </iframe>
    </div>
    

    Javascript:

    $(function() {
        $('.activator').click(function(e){
            e.preventDefault();
            $('.frame').attr("src", this.href);
    
            $('.overlay').fadeIn('fast', function(){
                $('.box').show('fast');
            });
        });
    
    
        $('.boxclose').click(function(){
            $('.box').hide('fast',function(){
                $('.overlay').fadeOut('fast');
            });
        });
    });
    

    Live DEMO

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

Sidebar

Related Questions

I would like to pop a modal dialog using jquery ui where the overlay
I currently have a very basic JQuery script accompanied by some CSS that helps
I have basic Spring MVC 3 setup for i18n where I can show labels
I have a basic nServicebus 3.2.0 setup with a web application endpoint and a
I have some basic jquery code sitting in the header of the header file
I'm using Visual Basic 2010 Express. I have a form that can be minimized.
I have a basic jquery-ui dialog widget that is set to execute on a
I am using jquery tools tooltips on an image. It's a basic use of
I'd like to have the home screen style for a section of my app,
Kind of a basic question, but I have a page similar to this example:

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.