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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:03:41+00:00 2026-05-21T20:03:41+00:00

Issue I’m planning on making a lightbox-like project page. I want to have it

  • 0

Issue

I’m planning on making a lightbox-like project page. I want to have it where the user clicks on an image and it brings up a div that contains a article with paragraphs, images, and whatever else I want to put in it. It will basically be a scrollable article that hovers over the original page which the user can close to see the project page again. I’d prefer to not force the user to download every article when they enter the gallery page.

Request

Is there a way to pull a small article like this from say, an html file stored on the server? Is there a better way to approach this problem?

-edit- I’d prefer to not use jQuery or any other javascript library. This website will be presented to a Javascript course, so I would like it all to be normal javascript code. Besides, I’d would rather learn how jQuery does it than use use it blindly.

Thanks in advance!

  • 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-21T20:03:42+00:00Added an answer on May 21, 2026 at 8:03 pm

    Here’s a simple lightbox in pure JavaScript, loading its content from a specified URL. It doesn’t handle errors gracefully and if it works in IE, it’s only in newer versions.

    Since it is taking the HTML of the target page and inserting it into your document directly, it might behave oddly if the URL points to a complete HTML page. It would work best if the URL only points to an HTML snippet (no <html> or <body> tags).

    var lightboxPage = function(path) {
      // fetches content from a specified path and displays it in a lightbox
    
      var backdrop = document.createElement("div");
      var content = document.createElement("div");
    
      content.innerText = "Loading...";
    
      // use AJAX to load the content from the page
      var request = new XMLHttpRequest();
    
      request.open("GET", path, false);
    
      var handleAjaxEvent = function() {
        // this function is called multiple times during the AJAX request.
        // a state of 4 means that the request has completed.
        if (request.readyState == 4) {
            content.innerHTML = request.responseText;
        }
      }
    
      request.onreadystatechange = handleAjaxEvent;
      request.send();
    
      backdrop.style.position = "fixed";
      backdrop.style.top = 0;
      backdrop.style.height = "100%";
      backdrop.style.left = 0;
      backdrop.style.width = "100%";
      backdrop.style.zIndex = 500;
      backdrop.style.background = "black";
      backdrop.style.opacity = 0.8;
    
      content.style.position = "fixed";
      content.style.top = "10%";
      content.style.height = "80%";
      content.style.left = "10%";
      content.style.width = "80%";
      content.style.zIndex = 600;
      content.style.border = "none";
      content.style.overflow = "auto";
      content.style.background = "white";
    
      document.body.appendChild(backdrop);
      document.body.appendChild(content);
    
      var removeLightbox = function() {
        document.body.removeChild(backdrop);
        document.body.removeChild(content);
      }
    
      // remove the lightbox when people click on the backdrop
      backdrop.addEventListener("click", removeLightbox)
    };
    
    // example usage
    lightboxPage("test.html");
    

    Mozilla’s AJAX tutorial may be of use to you as well.

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

Sidebar

Related Questions

Issue is SOLVED: Problem is that it is a pre-compiled web page project and
Issue I have an aspx page with jQuery code to send an ajax request
Issue: I have a markup like this (only the important lines): <%@ Control Language=C#
Issue adding on change event to a control. I currently have a page that
Issue is only with Safari: I have three tabs that each show a div
issue facing while loading the messages in to mq channel, recieving an error like
Issue - We have a spreadsheet with thousands of addresses but no counties. Goal
Issue In the below code , say if i want to change the color
Issue: I am using the Microsoft.Office.Interop.Excel library in an ASP.NET application, and I have
Issue is that I have wrote a method to duplicate selected row in 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.