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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:20:52+00:00 2026-05-25T18:20:52+00:00

So I am appending a div to the body and this div will popup

  • 0

So I am appending a div to the body and this div will popup on click of on image a tag actually. To achieve the body overlay effect, I am using fancybox. However I am able to append the div to body, but this div doesn’t load as a fancybox. Can someone help here:

My code is here:

http://jsfiddle.net/refhat/xap9F/60/

Further am I missing something in the fancybox, I am also not seeing the close cross on top right corner of fancybox in chrome and clicking anywhere on fancybox just closes the fancybox, which should not be the case.

  • 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-05-25T18:20:53+00:00Added an answer on May 25, 2026 at 6:20 pm

    Here is some code you could use to create an overlay:

    overlay = function () {
        var o, c;
        this.create = function (html) {
            o = $('<div />');
            c = $('<div />');
            h = $('<div>' + html + '</div>').appendTo(c);
    
            var o_css = {
                'position': 'absolute',
                'top': '0',
                'left': '0',
                'width': '100%',
                'height': '100%',
                'background': '#000', // Background of the overlay (opacity is set later)
                'z-index': '10000',
                'overflow': 'hidden'
            };
            var c_css = {
                'position': 'absolute',
                'top': '50%',
                'left': '50%',
                'width': '300px', // Width of content box
                'height': '200px', // Height of the content box
                'margin-left': '-150px', // Half of content width (used to center the box)
                'margin-top': '-100px', // Half of content height (used to center the box)
                'background': '#fff', // Background of the content
                'color': '#000', // Text color
                'z-index': '10001'
            };
            var h_css = { 'padding': '10px' }; // If you want paddning
    
            o.css(o_css);
            c.css(c_css);
            h.css(h_css);
    
            o.fadeTo(0, 0).appendTo('body').fadeTo(500, 0.5); //0.5 is opacity, change from 0.1-1.0
            c.fadeTo(0, 0).appendTo('body').fadeTo(500, 1.0); //1.0 is opacity, change from 0.1-1.0
        }
        this.remove = function () {
            o.remove();
            c.remove();
        }
    }
    

    And you call it like this:

    $(document).ready(function () {
        o = new overlay();
        o.create('HTML you want to fill the container with, example and image or/and text or maybe a link you later bind o.remove() to'); //This creates the overlay
        o.remove(); // .. and this removes the overlay
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having issues appending a div to the body tag in IE 9
With jquery I am adding a div and appending the text click to view
I am in a situation I am appending a button to a div, which
When appending to a file using Windows batch commands, how to append immediately after
I am appending new data - $('#posts').append(data); But I want this new data to
I am having trouble appending multiple variables to the end of a url using
Here the syntax I am using for appending text. $(#table).append(<span>Append some text here..</span>); I
I have this code: if (Page.IsPostBack) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Javascript, alert('test');jQuery('html, body').animate({ scrollTop: jQuery('.newslettersubscribe').position().top },
I have the following image being placed at the top of a page. <body>
In a scenario where I am appending something like a div to the html

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.