Fullscreen overlay or pop-up display

I have a website with images and iframes displayed within a fancybox. Everything is functioning properly, but now the website's requirement is to have a fullscreen overlay like on the usatoday website.

Take a look at for reference.

When clicking on any article, the overlay will display.

The desired effect is to create a full page overlay or popup when clicked. I need a good example to achieve this.

Thank you!

Answer №1

Take a look at this example demonstrating overlay functionality: CLICK HERE

(function($) {
  $('article').on('click', function() {
    if($('.overlay').length < 1) {
       $('body').append('<span class="overlay"></span>');
    }
  });

  $(document).on('click','.overlay', function() {
    $('.overlay').remove();   
  });
})(jQuery);

You can also utilize buttons to trigger the opening and closing events of fancybox.


.overlay {
  background: rgba(50,50,50,0.5);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

Answer №2

To adjust the size of an iframe from within the embedded page, you will need to implement your own resizing logic.

Start by creating a function in the parent page that can resize both the width and height of the iframe.

For example:

function resizeIframe(height, width){
    $("#your_iframe_id").css('width', width);
    $("#your_iframe_id").css('height', height);        
}

Then, from within the embedded page, you can invoke this function during any page load event.

window.parent.resizeIframe(new_height_value, new_width_value);

I trust this guidance will be beneficial to you.

Answer №3

Although this answer may be considered outdated, there exists a jquery plugin that accomplishes the same task. You can locate the plugin here

When it comes to implementing this plugin, its usage is relatively straightforward.

Firstly, ensure that jquery is loaded before proceeding with this:

<script type="javascript" src="jquery.js"></script>
<script type="javascript" src="jquery.blockUI.js"></script>
....
....
<script>
   $(document).ready(function(){
     $("#<BUTTON_ID>").click(function(){
        $.blockUI();

        setTimeout(function(){
           $.unblockUI(); 
        }, 2000);
     });
   });
</script>

FYI: The provided code is quite basic.

I hope you find this information helpful.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Adding a Timepicker to a Datepicker on a jsp webpage with javascript

I am working on a JSP page that includes a date picker. I want to enhance this datepicker by adding a start time and end time within the calendar itself. How can I achieve this? Additionally, I need to implement validation ensuring that the start time is a ...

Accessing a JSON array from PHP script with the help of jQuery

Recently, I delved into the world of jQuery and PHP by attempting to pass variables from Javascript to a PHP script using $.ajax. Despite my lack of expertise in this area, I managed to write some code that kind of worked. However, today I encountered a n ...

I'm struggling to understand why the background-color is affecting the margins as well

Check out this code snippet: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title></title> <style type="text/css"> * {border: 0px; padding: 0px;} ...

Error Alert: JQuery Pop Up Issue

Struggling with getting my JQuery Pop-Up Box to work properly. Any guidance for a newbie like me on how to fix it would be greatly appreciated. Here's the code I've been working on: <!-- POP UP HTML --> <div class="infocontainer"> ...

"Enhance user experience with a dynamic jQuery dropdown menu

I am working on a menu and need to make specific changes for Safari browser. I want only one submenu to be visible when hovered over a link. I believe this can be achieved using $this, but I am unsure about where and how to implement it. Thank you in adv ...

Update a mySQL table using dynamic input from a table

I'm facing challenges updating a mysql database with a dynamic table that allows me to add or remove rows before submitting the form. While I can make it work with hardcoded values, I struggle when trying to update with a while loop. It just doesn&ap ...

Is it possible to generate excel spreadsheets using a selection in Laravel?

In my system, I have implemented a radio group as a filter for my table which displays items as active, inactive, or both. Additionally, there is a button that allows users to export the table data into an Excel document. Currently, the export button downl ...

Error message: The function .datepicker('getDate') caused an Uncaught TypeError: Data[option] error

Encountering an issue with the code data[option] is not a function when attempting to utilize .datepicker('getDate'). The datepicker was initialized using this code: <h4>Transaction Date:</h4> From: <input id="sta ...

consistent height across the div when expanding

There is a recurring issue I encounter where it takes too long for me to solve the problem. My goal is to ensure that the bootstrap boxes at the bottom of the page have the same height. I attempted to set a fixed height in pixels using my CSS, but this cau ...

Navigating from an offspring link to a social media platform page

I just launched my website and noticed that some sites and ads redirect users to their social media pages directly from the site. For example: mysite.com/facebook redirects to facebook.com/mysitesfbpage mysite.com/twitter redirects to twitter.com/mysite ...

Automatically shift focus after being focused on

I recently created a piece of jQuery code for a mobile website. Whenever I tap on the delete button, it erases the input and directs the focus to another input area. However, it then automatically loses focus after using the focus() method. $(document). ...

Improving Performance of a Large Unordered List using JavaScript

My website currently features a search box that retrieves images and displays them in a list format. Each image has an associated click event that triggers an overlay on the parent li element when clicked. However, with search results exceeding 300 images ...

Searching using wildcards in a single text field in MySQL using PHP on a web page created with

Recently, I acquired some PHP scripts from a coworker that includes a search functionality for the "Notes" text field in a database named "Sheep". The search is conducted through a text box: https://i.sstatic.net/NbwMF.png Here is the code for the search ...

Executing a JavaScript function when a column in a Fusion Chart is clicked

I have two div elements in HTML and I would like to have div2 load when div1 is clicked. Additionally, whenever div2 loads, a back button should also appear to return to div1. Is there a way to achieve this using HTML? <td background="images/bgTd.gif ...

Steps for adding a navbar that slides horizontally and overlaps other links on a webpage

I am attempting to design a sliding navigation menu using JQuery. The concept involves having multiple main sections, each with several subsections. When a user hovers over a section, the subsections will expand horizontally. If another section is current ...

Can an image map area be identified using radial coordinates?

While I have experience with online Imagemap Generators for rectangular or circular areas in HTML pages, things get a bit tricky when dealing with pie-shaped sections. When trying to make each pie slice a separate area, the image map code generated by thes ...

How do I insert a new column for the Name attribute in ASP.NET Core Identity without using the Username field?

I'm currently utilizing ASP.NET Core Identity within my project. I have a form that includes fields for Name and Username. The issue arises when attempting to save values from the Name field, as it triggers an error stating that they are not in the co ...

Is there a way to get pQuery to function properly with HTML that is slightly malformed?

pQuery is an innovative adaptation of the jQuery JavaScript framework to Perl that serves the purpose of screen scraping. pQuery has shown a high sensitivity to malformed HTML content. Take, for instance, the following scenario: use pQuery; my $html_mal ...

Header fixed vertically

I am currently working on a webpage with a minimum width requirement of 1124px. This means that whenever the browser window is smaller than that, the content of the page needs to be scrolled horizontally instead of smoothly transitioning into a responsive ...

Could you assist me in setting up a loop for this Slideshow that times out and then resets back to the beginning?

Currently, I am in the process of developing a slideshow using jQuery. My main struggle lies in creating a loop that will timeout the slideshow for a specific duration, say 10 minutes, before it reappears and resumes indefinitely. Unfortunately, my attempt ...