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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:44:37+00:00 2026-06-09T14:44:37+00:00

How can I use FancyBox or JQuery to create multiple pop-up DIVs that all

  • 0

How can I use FancyBox or JQuery to create multiple pop-up DIVs that all use the same class (no IDs) on one page? For example, I have 50 products on a single page that all have the same class names.

<div class="popup_box"> <!-- OUR PopupBox DIV-->
    <h1>This IS A Cool PopUp 1</h1>
    <div class="closePopup">Close</div> 
</div>
<div class="overlay_box"></div>
<div class="menu_item_container"> <!-- Main Page -->
    <h1 class="container_header">Sample 1</h1>
</div>

<div class="popup_box"> <!-- OUR PopupBox DIV-->
    <h1>This IS A Cool PopUp 2</h1>
    <div class="closePopup">Close</div> 
</div>
<div class="overlay_box"></div>
<div class="menu_item_container"> <!-- Main Page -->
    <h1 class="container_header">Sample 2</h1>
</div>
<div class="popup_box"> <!-- OUR PopupBox DIV-->
    <h1>This IS A Cool PopUp 3</h1>
    <div class="closePopup">Close</div> 
</div>
<div class="overlay_box"></div>
<div class="menu_item_container"> <!-- Main Page -->
    <h1 class="container_header">Sample 3</h1>
</div>

<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js" type="text/javascript"></script>

<script type="text/javascript">

    $(document).ready( function() {

        // When site loaded, load the Popupbox First
        $('.container_header').click( function() {          
            loadPopupBox();
        });

    $('.closePopup').click( function(){

            unloadPop()

        });



    });

    function loadPopupBox() {   // To Load the Popupbox
            $('.popup_box').fadeIn("slow");
            $('.overlay_box ').fadeIn("slow");      
        }

        function unloadPop(){

            $('.popup_box').fadeOut("slow");
            $('.overlay_box ').fadeOut("slow");
            }


</script>

THE CSS

<style type="text/css">
/* popup_box DIV-Styles*/
.overlay_box{
    display:none;
    position:fixed;  
    _position:absolute; /* hack for internet explorer 6*/  
    height:100%;  
    width:100%;  
    top:0;  
    left:0;  
    background:#000000;  
    border:1px solid #cecece;  
    z-index:1; 


    }
.popup_box { 
    display:none; /* Hide the DIV */
    position:fixed;  
    _position:absolute; /* hack for internet explorer 6 */  
    height:300px;  
    width:600px;  
    background:#FFFFFF;  
    left: 300px;
    top: 150px;
    z-index:100; /* Layering ( on-top of others), if you have lots of layers: I just maximized, you can change it yourself */
    margin-left: 15px;  

    /* additional features, can be omitted */
    border:2px solid #ff0000;   
    padding:15px;  
    font-size:15px;  
    -moz-box-shadow: 0 0 5px #ff0000;
    -webkit-box-shadow: 0 0 5px #ff0000;
    box-shadow: 0 0 5px #ff0000;

}

.menu_item_container{
    background: #d2d2d2; /*Sample*/
    width:100%;
    height:100%;
}

h1.container_header{  
cursor: pointer;  
} 

/* This is for the positioning of the Close Link */
.closePopup {
    font-size:20px;  
    line-height:15px;  
    right:5px;  
    top:5px;  
    position:absolute;  
    color:#6fa5e2;  
    font-weight:500;    
}
</style>

It should work like this example (please click on the product to test pop-up):

http://www.grubhub.com/order.jsp?custId=263838&cityId=5&orderId=18429055&searchable=true&deliverable=true&verified=false&poiSearchTerm=null

  • 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-09T14:44:39+00:00Added an answer on June 9, 2026 at 2:44 pm

    You should do something like this:

    $('.container_header').click( function() {          
        $(this).parent().prev().prev('.popup_box').fadeIn("slow");
    });
    
    $('.closePopup').click( function(){
        $('.popup_box').fadeOut("slow");
        $('.overlay_box ').fadeOut("slow");
    });
    

    SEE DEMO (Result Only)

    SEE CODE HERE

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

Sidebar

Related Questions

I use jquery fancybox 1.3.4 as pop form. but I found fancybox can't bind
You can use more than one css class in an HTML tag in current
How to use multiple jQuery Plugins in one File? I have to use jCarousel
I can use .button() to create beautiful submit buttons, but the rest of the
I'm experiencing a little bugger using the fancybox jquery plugin. I want to use
I am trying to use the fancybox system described here: http://fearlessflyer.com/2011/01/create-an-awesome-photo-gallery-with-fancybox-and-timthumb/ I can get
I'm using Fancybox for a jQuery lightbox and it only works with one href
I Use Fancybox to display complex forms on an intranet site. The page the
I can't resize my fancybox, when I use ajax... This is how my code
I am trying to use jQuery Fancybox to popup a youtube video from a

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.