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

Struggles with closing dropdown menus

How can I modify my drop down menu so that the first drop box closes when a new link is clicked? Additionally, how do I ensure that the menu closes when clicking on a child item without refreshing the page (since the content is dynamically pulled from a ...

Leveraging an AngularJS variable within an iframe

Is it possible to use a variable inside an iframe src or ng-src attribute? I've tried different variables but none seem to be recognized. For example: <iframe ng-src="http://www.example.com/?name={{test}}"> </iframe> The variable test ju ...

Modify the class of the dropdown and heading 2 elements if they meet specific conditions using Animate.css

Is it possible to add a class using jQuery when two specific conditions are met? 1) If the dropdown selection is either "acting" or "backstage" 2) If the membership status is set to "Non-member" If both of these requirements are fulfilled, I would like ...

Saving HTML files can cause formatting issues

After creating a website with the web design tool "Nicepage", I noticed something strange. When visiting the site through this link: It appears to be working perfectly fine (please let me know if it isn't). The layout should resemble this image: htt ...

How are the script name and script file connected in WordPress enqueuing?

When adding a jQuery script to the function.php file using the enqueue method, how does the script name relate to the actual file that contains the jQuery code? Is the script name arbitrary, or is it derived from either the file name or the actual script w ...

Using JQuery to loop through every link in a particular row of a table

Here is the table I am working with: <table border="1" id="tbl"> <tr class="clsHead"> <td> <a href="b.aspx">first row first cell</a> </td> <td> <a href="b.asp ...

Ensuring Input Integrity: Utilizing HTML and Javascript to Block Unfilled Form Submissions

Currently, I am working on developing a registration page using HTML and JavaScript. Although I have added the 'required' tag in HTML to prevent users from submitting empty input fields, I noticed that users can bypass this restriction by simply ...

Exploring the Dynamic Capabilities of AJAX in a CodeIgniter Controller

I am aiming to dynamically parse RSS feeds by utilizing a select list to send a value (id) to the controller via ajax. Subsequently, I aim to parse RSS feeds that correspond to the specific id. The following is a snippet from my Controller home.php : fun ...

When working with ASP.NET MVC 3, be aware that the ContentResult may not accept a class that inherits from

After my previous question regarding finding nearby entities with Bing Maps REST control, I have made some modifications. Within the for loop of the function DisplayResults(response), the following code has been added: var loc = new Array(); loc[0 ...

Generating modal pages on the fly

One thing that's been on my mind is creating modals for my page. Typically, I would include the HTML code for my modal directly in the page like this: <div class="my-modal"> <form action="/home/index"> <input type="text" class="txt- ...

The jQuery hover function is not functioning properly on page load in Firefox

While this code is functioning smoothly in Chrome and IE, it seems to be encountering issues in Firefox! <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> JS: $(window).load(function(){ $("#bosti ...

I require an HTML <select multiple> element that includes a disabled option

Can anyone help me figure out how to create a multi-select box with a disabled element? I want the box to have the following options: All ----or---- option 1 option 2 I don't want the "----or----" option to be selectable. Here's the code I&a ...

Transforming react.js into HTML and CSS programming languages

I have a small experiment I need help with. As I am not familiar with react.js, I would like to convert my main.jsx file into pure HTML/CSS/JS without using react. The issue I'm facing is how to handle form data submission to the server in vanilla HTM ...

CSS Dropping Down Menu Design

Hello everyone! I am taking my first step into web development and currently in the process of revamping my DJ website. Check out my updated site here: I am working on creating a dropdown div within the top-left menu that will display information about t ...

Problems arise when attempting to use CSS content for double quotes

Could someone confirm if the syntax '>\0147' is correct? .blockquote p::before { content: '>\0147'; font-family: serif; font-size: 3em; line-height: 0; display: block; margin: 0 0 20px 0; } ...

During the serialization process of a System.Reflection object, a circular reference was identified

One of my asp.net MVC 3 controller action methods looks like this: public JsonResult GetRecordingRates(int Id) { List<DefaultRateChart> defaultRateCharts = new List<DefaultRateChart>(); using (IDefaultRateChartManager defau ...

Utilize jQuery to target elements containing more than one class

Suppose an element has several classes as shown below: class="btn btn-primary add-movie-button is-on" Is it possible to select this element using only one class name with jQuery, for example: $(".add-movie-button") Can the method .hasClass("is-on") be ...

How can we include identical item names within a single JavaScript object?

My attempt at achieving the desired result involves creating an object like this: var obj = {id: id, items: "asdf", items: "sdff", test: varTest}; However, I face a challenge where I need to dynamically add two elements with the same name 'items&apo ...

Utilize JavaScript to trigger a div pop-up directly beneath the input field

Here is the input box code: <input type='text' size='2' name='action_qty' onmouseup='showHideChangePopUp()'> Along with the pop-up div code: <div id='div_change_qty' name='div_change_qty&ap ...

`Erase content from a field once text is typed into a different field`

I have a Currency Converter with two input fields and a button. I enter the amount to be converted in the first field, and the result of the conversion appears in the second field. My question is: How can I automatically clear the second field when I type ...