iFrame is a great way to use it as a popup layer to cover the background

iFrame is a great way to use it as a popup layer to cover the background
I have been working on a project recently - Budou Collection. In short, it is to collect the pictures you like to the Budou page. Many aspects of iframe are used in this process, which can be summarized as follows:

1. As a pop-up layer to cover the bottom

If you have ever made a black mask covering the entire page, and the user happens to be using IE6, and there happens to be a select element on the page, then you will have a headache (I won’t go into the principles here). We will find that the pop-up DIV cannot cover the select, so it is our iframe's turn to appear. The logic is as follows:

Put an iframe at the same level as the pop-up div
Ensure that the z-index of the iframe is smaller than the z-index of the pop-up div
Add window resize and scroll events to ensure that the iframe can cover the entire page

Part of the code

Copy code
The code is as follows:

var iframe = U.isie6() ? '<iframe style="position:absolute;left:0;top:0;z-index:2000000;filter:Alpha(opacity=0); width:100%;height:' + ds.height + '" frameborder="0"></iframe>' : '';
$container.append(iframe).appendTo($body);

2. Writing cookies across domains

There are two domains, a.com and b.com. Under certain conditions, some of the functions of b will appear on page a. Sometimes when operating page a, you need to do some operations on the cookies of domain b.com to facilitate the user's next visit. We only need to add an iframe (dynamic or fixed) to page a, with the src attribute pointing to a proxy page of b, and perform cookie operations on this page.

<<:  Detailed explanation of several API examples commonly used in advanced javascript front-end development

>>:  The English reading of various special symbols on the keyboard (knowledge popularization)

Recommend

Detailed explanation of samba + OPENldap to build a file sharing server

Here I use samba (file sharing service) v4.9.1 + ...

Solution for Nginx installation without generating sbin directory

Error description: 1. After installing Nginx (1.1...

Sample code for html list box, text field, and file field

Drop-down box, text field, file field The upper p...

Network management and network isolation implementation of Docker containers

1. Docker network management 1. Docker container ...

SELinux Getting Started

Back in the Kernel 2.6 era, a new security system...

Introduction to document.activeELement focus element in JavaScript

Table of contents 1. The default focus is on the ...

js implementation of verification code case

This article example shares the specific code of ...

Tutorial on logging into MySQL after installing Mysql 5.7.17

The installation of mysql-5.7.17 is introduced be...

Html+CSS drawing triangle icon

Let’s take a look at the renderings first: XML/HT...

CSS container background 10 color gradient Demo (linear-gradient())

grammar background: linear-gradient(direction,col...

How to add vector icons to web font files in web page production

As we all know, there are two types of images in c...

Two ways to clear float in HTML

1. Clear floating method 1 Set the height of the ...

How much data can be stored in a MySQL table?

Programmers must deal with MySQL a lot, and it ca...

6 solutions to IDEA's inability to connect to the MySQL database

This article mainly introduces 6 solutions to the...